#include #include #include #include "FDIuir.h" #include int CVICALLBACK FDI_Status_CB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { char coms[]="*STB?\n"; char comc[523]; char comc2[]="*ESR?"; int retcnt0; int stat=-1,stat2=-1; int comp,comp2; int mask=1; double statind=-2; ViChar l_buffer[300]; Point TabCell,TabCell2; int i=-1; switch (event) { case EVENT_COMMIT: GetCtrlVal(FDIPanel,PARPNL_CMD,comc); //retcnt0=FDIWrite(vi, coms); retcnt0=FDIWrite(vi, comc); stat=FDIReadStatus(vi,(ViPBuf)l_buffer); statind=(double)stat; SetCtrlVal(FDIPanel, PARPNL_NUMERIC_STATUS , statind); retcnt0=FDIWrite(vi, comc2); stat2=FDIReadStatus(vi,(ViPBuf)l_buffer); for(i=1; i<=8 ; i++) { TabCell.y=1; comp=stat & (mask<<(i-1)); TabCell.x=i; if(comp!=0) { SetTableCellAttribute (FDIPanel, PARPNL_TAB_FDI_STATUS, TabCell, ATTR_TEXT_BGCOLOR, VAL_RED); } else { SetTableCellAttribute (FDIPanel, PARPNL_TAB_FDI_STATUS, TabCell, ATTR_TEXT_BGCOLOR, VAL_WHITE); } TabCell2.y=2; TabCell2.x=i; comp2=stat2 & (mask<<(i-1)); if(comp!=0) { SetTableCellAttribute (FDIPanel, PARPNL_TAB_FDI_STATUS, TabCell2, ATTR_TEXT_BGCOLOR, VAL_RED); } else { SetTableCellAttribute (FDIPanel, PARPNL_TAB_FDI_STATUS, TabCell2, ATTR_TEXT_BGCOLOR, VAL_WHITE); } } retcnt0=FDIWrite(vi, comc); stat=FDIReadStatus(vi,(ViPBuf)l_buffer); //if(Status1Byte[i]=='1') // {SetTableCellAttribute (FDIPanel, MLPNL_STATUS_TABLE, TabCell, ATTR_TEXT_BGCOLOR, VAL_WHITE); // } // else // {SetTableCellAttribute (MLabPanel, MLPNL_STATUS_TABLE, TabCell, ATTR_TEXT_BGCOLOR, VAL_GRAY); // } break; } return 0; } int CVICALLBACK FDI_Panel_CB(int panel, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_CLOSE: QuitUserInterface (0); viClose(rm); } return 0; }