Vaisala WINDCAP WMT52 User Manual Page 34

  • Download
  • Add to my manuals
  • Print
  • Page
    / 43
  • Table of contents
  • TROUBLESHOOTING
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 33
34 Orion LT Weather Station
________________________________________________________________________________________________________________________
CRC-16 Computation
The computation of the CRC is performed on the data response before parity is added. All operations are
assumed to be on 16 bit unsigned integers. The least significant bit is on the right. Numbers preceded by
0x are in hexadecimal. All shifts shift in a zero. The algorithm is:
Initialize the CRC to zero. For each character beginning with the address, up to but not including the
carriage return (<cr>), do as follows:
{
Set the CRC equal to the exclusive OR of the character and itself
for count =1 to 8
{
if the least significant bit of the CRC is one
{
right shift the CRC one bit
set CRC equal to the exclusive OR of 0xA001 and itself
}
else
{
right shift the CRC one bit
}
}
}
Encoding the CRC as ASCII Characters
The 16 bit CRC is encoded to three ASCII characters by using the following algorithm:
1 st character = 0x40 OR (CRC shifted right 12 bits)
2nd character = 0x40 OR ((CRC shifted right 6 bits) AND 0x3F)
3rd character = 0x40 OR (CRC AND 0x3F)
The three ASCII characters are placed between the data and <cr><lf>. Parity is applied to all three
characters, if selected for the character frame.
The CRC computation code is added to the end of the response, if the first letter of the command is sent by
using lower case.
Page view 33
1 2 ... 29 30 31 32 33 34 35 36 37 38 39 ... 42 43

Comments to this Manuals

No comments