Modbus RTU Error

A

Thread Starter

akhil

pls snd me code for modbus rtu using pic or 8051 in c. I am sending data 01, 03, 00, 00, 00, 01, 84, 0a, but response is coming as f9, f3, 3e, etc. How to resolve this error. Pls mail the solution too on how to create 3.5 character delay.

pls................ anybody . can help me...
 
L

Lynn August Linse

Sorry cannot help other than to say this looks like either a baud rate problem or noise/echo problem.

Lots of odd data with runs of '1' bits is common if a receiver set at 9600 baud sees a message from a transmitter at 2400 baud because each '1' bit sent at 2400 baud looks like 4 '1' bits at 9600 baud.
 
Hai,
How to calculate the CRC checksum error?. Actually, I sent 34000 to the 40048 address.
It shows some hexa code in the MDbus monitor. Like, 01 03 04 84 B5 00 00 C3 25.
01-SLAVE ID
03-Function code
04-Byte count
84 B5-value which I have sent
00 00-data
C3 25-CRC Checksum error
what is the calculation for checksum error? What does C3 25 define? Kindly clarify this.
 
To actually calculate the CRC (for verification, etc.), you can use an online CRC calculator such as this:
https://www.lammertbies.nl/comm/info/crc-calculation

Note, though, as stated in the spec David linked, the CRC is encoded low byte first then high byte in the Modbus message, so the CRC value for your above example is 0x25C3.

Also, an interesting property of a CRC, is that if you include the CRC bytes in the calculation, the result has a value of 0. This property is frequently used when receiving a message that includes the CRC to easily confirm there are no errors in the message.
 
Thank you for your response. I need some clarification in the previous query. Now I got some other hexacodes from the MDbus monitor. I cannot solve that. 0C 03 01 0E 00 0A A4 EF. Kindly specify the hex code to the list of items
1. Slave Id-0C
2. Function code-03
3. Byte count-01
4. Data-???? How can I decide because it has 3 sets 0E 00 0A?
5. CRC-A4EF
Kindly clarify this
Thanks in Advance
 
The bytes you've shown correspond to a request packet, not a response. It's a request to device 12 to read 10 Holding Registers starting at 40271.

1. Slave Id-0C
2. Function Code-03
3. Starting Register Address-010E
4. Number of Registers-000A
5. CRC-EFA4

Note that the register address encoded in the packet does not include the 40,000 offset and is one less. So 40271 gets encoded as register address 270.

You can find more details on Modbus register numbering here:
https://control.com/forums/threads/modbus-register-numbering.49844/
 
How could you say that as a request? Tx is request and Rx is the response, right? I have attached the image file for your reference. In that, the above-mentioned hex code as an Rx-response. Kindly clarify it. Please provide the frame structure.
 

Attachments

Kindly provide the frame structure - both Rx and Tx for the below-attached image file. Please provide the Address and value for that corresponding address. Please look at it.

Thanks in advance
 

Attachments

How could you say that as a request? Tx is request and Rx is the response, right? I have attached the image file for your reference. In that, the above-mentioned hex code as an Rx-response. Kindly clarify it. Please provide the frame structure.
Judging by the packets shown in this capture, the RX packets are requests and the TX packets are responses. The device that the RX and TX are in relation to must be a Modbus slave device.

The packets you show in this image consist of requests for function code 16 - Preset Multiple Registers to both addresses 12 and 11 and for function code 03 - Read Holding Registers to address 12. The packet immediately prior to the one you've underlined is an exception response (invalid data address) to a function code 03 - Read Holding Registers request. Exception responses can only be transmitted by a Modbus slave device.

Something is not quite right about these packets, though. There are RX packets to device 12 (which I assume is this slave device's address) that are not responded to, and for some reason the function code 03 exception response (83 for exception responses) is shown before the function code 03 request.
 
Kindly provide the frame structure - both Rx and Tx for the below-attached image file. Please provide the Address and value for that corresponding address. Please look at it.

Thanks in advance
I'm sorry, but I am not going to decode this for you. I will say, though, that not all of the packets you show are even valid Modbus packets and they don't even seem to correspond to matching requests/responses between a master and slave.

You can decode these yourself by following the Modbus specification. I find it's actually a lot easier to use the older PI MBUS 300 for beginners to decode packets as this specification lists the packet format for requests and responses in a much more straight-forward way than the modern spec. This spec is available here:
https://modbus.org/docs/PI_MBUS_300.pdf

Please share what your goal is in asking all these questions about CRC's and Modbus packets. Are you trying to write your own Modbus driver? If we can understand what you're trying to achieve, it will help us understand and provide better guidance.
 
Top