Embedded Modbus Slave Response

C

Thread Starter

criders

Hello All,

I am working on an embedded device that will communicate to stuff via RS232 / RS485 port. As of today, I am able to get the data from a PC to the embedded device. I am now in the process of trying to decipher the data to find out if data is correct and the correct response to transmit. I know to do the following:

1.) check the data length : data > than 3 bytes
2.) check parity, overrun
3.) check crc
4.) check data address, function
5.) check modbus address
6.) update counters

I have two questions...

1.) Is there a specific order to check the modbus data to see if it is correct?

2.) Is there anything that I forgot?
 
Yes the order in which you check things matters. There are flow charts and state diagrams in the Modbus specs which specify the order in which things are to be checked. You should be following the order specified, as the same problem may result in a different error if checked in a different order, which will cause difficulties for anyone trying to troubleshoot communications problems.

If you are doing Modbus over serial lines, then at the very least you will need the spec for the serial communications (Modbus Over Serial Line), and the spec which describes each function (Modbus Application Protocol).
 
> Yes the order in which you check things matters. There are flow charts and state diagrams in the Modbus specs which <

Cool beans.
Thanks a lot. It looks like I was following the flowchart from the serial communications.
 
Top