同意楼上~~~DTR,RTS默认输出-10V
int CVICALLBACK DTR_CHECKBOX (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int val; int openmode; switch (event) { case EVENT_COMMIT: GetCtrlVal (panelHandle, PANEL_COMMCTRLSEL, &openmode); if (CommPort) { GetCtrlVal (panelHandle, PANEL_CHECKBOX_1, &val); if (val == 0) { if (openmode == 0) { ComSetEscape (CommPort, CLRDTR); } else { HotComm_SetEscape (CommPort, CLRDTR); SetCtrlVal (panelHandle, PANEL_RILED, HotComm_GetRINGPin (CommPort)); } } else { if (openmode == 0) { ComSetEscape (CommPort, SETDTR); } else { HotComm_SetEscape (CommPort, SETDTR); SetCtrlVal (panelHandle, PANEL_RILED, HotComm_GetRINGPin (CommPort)); } } SetCtrlVal (panelHandle, PANEL_DTRLED, val); SetCtrlVal (panelHandle, PANEL_COMMERROR, ""); } else { SetCtrlVal (panelHandle, PANEL_DTRLED, 0); SetCtrlVal (panelHandle, PANEL_CHECKBOX_1, 0); } break; } return 0; }
int CVICALLBACK RTS_CHECKBOX (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int val; int openmode; switch (event) { case EVENT_COMMIT: GetCtrlVal (panelHandle, PANEL_COMMCTRLSEL, &openmode); if (CommPort) { GetCtrlVal (panelHandle, PANEL_CHECKBOX_2, &val); if (val == 0) { if (openmode == 0) { ComSetEscape (CommPort, CLRRTS); } else { HotComm_SetEscape (CommPort, CLRRTS); } } else { if (openmode == 0) { ComSetEscape (CommPort, SETRTS); } else { HotComm_SetEscape (CommPort, SETRTS); } } SetCtrlVal (panelHandle, PANEL_RTSLED, val); } else { SetCtrlVal (panelHandle, PANEL_RTSLED, 0); SetCtrlVal (panelHandle, PANEL_CHECKBOX_2, 0); } break; } return 0; }
|
|