Compiled in c # PC serial port communication, since 232 is full duplex, so can open two line cheng send read data respectively, So if you are going to adopt the way of "question and answer" to communicate, use which way is better? 1, the simulation of the modbus pattern, add the CRC check code, such as PC sends the query command, the c # to receive data continuously, at the same time, CRC check requirements will send instructions on to the next step, to accept a long time, see error, 2, use ASCII format, add "\ n" after each instruction, readline () think send to receive instruction at a time, if the command unrecognized, think error, 3, other ways to share the bai!
CodePudding user response:
Then cycle in a thread to read data (reads), through setting instruction button to send (write), through the lock to lock function to send and receive data, but occasionally will appear "button to send, receive information loop reads" this how to return a responsibility?