The company is currently doing products are based on Modbus-rtu communication protocol, has been writing touch screen applications, more or less understand the touch screen Modbus-rtu module is how to work;
"Upper Machine"
Using the Cserialport class to achieve basic serial communication, each time a character is received, send a message to the main program to prompt the receiving processing, personal advice, should define a bytedata_queue to receive sent over the character data
Because the Bytedata_queue has a first-in-one feature, it also has a cache feature and can accept a lot of data;
Create a new thread to handle the received data, Readbytedata (&bytedata_queue, &data); The data data is then composed--->framedata, and a framedata_queue is defined to cache
Accept the encapsulated Framedata data frame and send a message to the main program or itself (the thread itself) once it is read to a new data frame;
"Lower Machine"
Similar to the upper computer processing .....
[00006]-[2015-08-17]-[00]-[modbus RTU Communication Protocol Implementation Ideas]