regarding string details about modbus rtu

R

Thread Starter

ravi

there is a string called crc - we would like to communicate with an instrument supporting modbus rtu in hyper link - hence we are in need to know about the crc string - any body can help me out???
 
L

Lewis Bodden

See "www.modbus.org":http://www.modbus.org .

The Cyclical Redundancy Check (CRC) field is two bytes, containing a 16-bit binary value.

The CRC is started by first preloading a 16-bit register to all 1's. Then a process begins of applying successive eight-bit bytes of the message to the current contents of the register. Only the eight bits of data in each character are used for generating the CRC. Start and stop bits, and the parity bit, do not apply to the CRC.

During generation of the CRC, each eight-bit character is exclusive ORed with the register contents. The result is shifted in the direction of the least significant bit (LSB), with a zero filled into the most significant bit (MSB) position. The LSB is extracted and examined. If the LSB was a 1, the register is then exclusive ORed with a preset, fixed value. If the LSB was a 0, no exclusive OR takes place.

This process is repeated until eight shifts have been performed. After the last (eighth) shift, the next eight-bit character is exclusive ORed with the register's current value, and the process repeats for eight more shifts as described above. The final contents of the register, after all the characters of the message have been applied, is the CRC value.

Simple.

There are application programs that can do this for you. See "www.parijat.com":http://www.parijat.com .
 
A

Alex Pavloff

There is a nice section about CRC at the back of the Modicon Modbus manual, complete with sample code.

Alex Pavloff
Software Engineer
Eason Technology
 
C

Curt Jeffreys

I don't think you understand Modbus RTU. This is a binary protocol, not ASCII/string based. Hyperlink is not going to work. You'll need an actual application written in VB, C, etc.

Check out "www.modbus.org":http://www.modbus.org for the specification for Modbus RTU.

Curt Jeffreys
 
Top