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