Modbus LRC Generation

I

Thread Starter

Ian Everett

I'm currently working on a modbus slave
to interface with a hotrunner system console.
I'm just implementing the ASCII protocol and am confused about when I should do the LRC check.
Is it when its in the ASCII message from the master or after I convert it to binary.
The "MODBUS over the serial line V1.0" doc is unclear to me, it almost seems that you should do it to the ASCII message, but that dosen't sound right, thanks..
 
B
Ian,

You should calculate the LRC check on the RTU message. Then convert it to ascii.

You are welcome to contact me, if you have more questions. Or need C code to do it.

B.R.
Brian
support(AT)wittecom.com
http://www.wittecom.com
 
L

Lorne Schneider

Ian Ignore the leading colon and the trailing CR, LF, convert the message to binary. Add up all the bytes (ignoring the carry), then do a two's compliment to get the LRC.

Regards Lorne R. Schneider
 
Top