Guo Bo Analysis Modbus host mode

Source: Internet
Author: User

Problem: Other people transplant well, send data errorcount=0, but I do not know what data is received, how to get it?

Add: I guess the data is transmitted to the string, then I use dev = Rt_device_find ("Uart1"); and (Rt_device_read (Dev, 0, &dat, 1) ==1) did not print to valid data

Analysis:

1. Since it is already transplanted, the data must not let me call the serial port data, there will definitely be a callback function, and then I can use the callback function to obtain valid data.

2. Since the transplant is good, there must be a callback function for the data, now it is to find the callback function, and then the value of the callback function to find and print out.

Results:

Finally find such a callback function EMBMASTERREGINPUTCB (UCHAR *pucregbuffer, USHORT usaddress, USHORT usnregs).

And then add a sentence in it. int i; for (i=0;i<12;i++) rt_kprintf ("%02x", pucregbuffer[i]); So my problem has been solved, the rest is to find a way to ensure that the data synchronization problem.

Guo Bo Analysis Modbus host mode

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.