Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/07/03 18:04
Read: times


 
#38509 - RE: CRC CALCULATION?
Responding to: ???'s previous message
and on a final note, I typed :-

"modbus CRC calulation" into www.google.com

and I got a link to this text :-

"CRC Calculation
Danaher Controls uses a Cyclical Redundancy Check (CRC) as a check sum method for MODBUS communications. The check-sum field is 2 bytes, which contains a 16 bit binary value.
A CRC is calculated by first loading a 16 bit register with FFFF. Then the process begins by applying successive 8 bit bytes of the message to the current contents of the register. The start bit, stop bits, and the parity bit do not apply to CRC calculation.


Generating a CRC

Load a 16 bit register with FFFF. Call this the CRC register.
Exclusive OR the first eight bit byte of the message with the low order byte of the CRC register, with the result being put into the CRC register.
Shift the CRC register one bit to the right (towards the LSB). Zero fill the MSB. Extract and examine the LSB.
If the LSB is 0, repeat the previous step (another shift). If the LSB is a 1, Exclusive OR the CRC register with the value A001 hexadecimal (1010 0000 0000 0001).
Repeat steps 3 and 4 until eight shifts have been performed. When this is done, a complete eight bit byte has been processed.
Repeat steps 2 through 5 for the next eight bit byte of the message. Continue until all bytes have been processed.

Result The final contents of the CRC register is the CRC value.

When the CRC is placed into the message, the upper and lower bytes must be swapped.

Example When the CRC is transmitted in the message, the low order byte will be transmitted first, followed by the high order byte. If the CRC value is 1241 (hexidecimal) then the value will be transmitted as 4112 (hexidecimal).
"

Is that good enough for you, or should I come over to your place of work and type the code in as well....

email me, and I will send you my address to send the plane ticket to.

Chris Brooks.

p.s. I only fly 1st class.


List of 18 messages in thread
TopicAuthorDate
CRC CALCULATION?            01/01/70 00:00      
   RE: CRC CALCULATION?            01/01/70 00:00      
   RE: CRC CALCULATION?            01/01/70 00:00      
      RE: CRC CALCULATION?            01/01/70 00:00      
         RE: CRC CALCULATION?            01/01/70 00:00      
            RE: CRC CALCULATION?            01/01/70 00:00      
         RE: CRC CALCULATION?            01/01/70 00:00      
            RE: CRC CALCULATION - Christian            01/01/70 00:00      
               RE: CRC CALCULATION - Christian            01/01/70 00:00      
                  RE: CRC CALCULATION - Christian            01/01/70 00:00      
               RE: CRC CALCULATION - Christian            01/01/70 00:00      
                  RE: CRC CALCULATION - Christian            01/01/70 00:00      
   RE: CRC CALCULATION?            01/01/70 00:00      
   RE: CRC CALCULATION?            01/01/70 00:00      
      RE: CRC CALCULATION?            01/01/70 00:00      
   RE: CRC CALCULATION?            01/01/70 00:00      

Back to Subject List