[00006]-[2015-08-17]-[00]-[modbus RTU Communication Protocol Implementation Ideas]

Source: Internet
Author: User

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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.