Use the several functions
SetCommMask (hCommFile EV_ERR);//////set monitoring error event
ClearCommError (hCommFile, incremented, @ stat);
WaitCommEvent (hCommFile dwEventMask, NULL)////.
And then he stay in this way, WaitCommEvent, that is to say there has been no incidents
CodePudding user response:
Without a serial port control? Simple cport and spcomm will do,API directly, trouble
CodePudding user response:
WaitCommEvent under the second parameter to confirm whether there is a problem?CodePudding user response:
I found parity check allows debugging results DCB. FParity setting is not successful, I set it to true, but to read when he has now become a 0,DCB DCB.
GetCommState (hCom, & amp; DCB);//get the current state of serial port information
Int a=DCB. FParity; The variable///debugging time observation, discover 0
Int b=DCB. Parity;
DCB. FParity=1;//setting allows parity
DCB. Parity=EVENPARITY;///accidentally bit check
SetCommState (hCom, & amp; DCB);//set the serial port information
A=DCB. FParity;//the problem is out of here, a result is 0.
B=DCB. Parity;
Why would this fParity level setting is invalid, please?