![Emerson DL8000 Instruction Manual Download Page 205](http://html.mh-extra.com/html/emerson/dl8000/dl8000_instruction-manual_102194205.webp)
DL8000 Preset Instruction Manual
Revised February-2016
Communications Protocols
D-77
D.6 BCC Calculation
The destination station uses block check characters (BCCs) to verify the
accuracy of received data. The transmitting station calculates the BCC
for each message and transmits them. The receiving station then
calculates the BCC for each message it receives and then compares the
calculated BCCs to the received BCCs. A difference between two BCCs
indicates a data error and so that do not reply. While responding to
messages it is a good practice to calculate the BCC first and then make
frame and reply back to the TAS.
Following is an example of the steps involved in calculating the CRC-
16 using C language. Below is the CRC-16 calculation steps using C
language. Consider following sequence for CRC-16. CRC-16 Checksum
Table is given below.
Data Sequence: 01 41 02 21 (consisting of address byte, function code
and data fields)
1.
Take two variables each of two-bytes size:
crcResult = FFFFh and tempVar = FFFFh.
2.
Take another one byte variable dataByte = 01h (first byte of frame)
3.
Repeat following steps for each data byte (dataByte) in the frame up
to last byte in frame
a.
crcResult = crcResult << 8 (left shift by 8) –
Result
= FFFF SHL 8 = FF00
b.
tempVar = tempVar >> 8 (right shift by 8) –
Result
= FFFF SHR 8 = 00FF
c.
tempVar = tempVar ^ dataByte (EXOR operation) – dataByte
=01
Result
= 00FF XOR 01 = 00FE
d.
tempVar = crc16Table [tempVar] (Get value from CRC-16
table shown below using tempVar as an index)
Result
= crc16Table [00FE] = 8180
e.
Get final CRC-16 answer of first byte by crcResult = crcResult ^
tempVar (EXOR operation)
Result
= FF00 XOR 8180 = 7E80
f.
Assign value of first CRC-16 to crcResult and tempVar
4.
Finally after calculating CRC using last data byte of the frame the
result comes to be 90B4. This CRC-16 checksum should be
transmitted upper byte first (BCC1 = 90h) and lower byte second
(BCC2 = B4h), The complete message with CRC-16 checksum is:
01 41 02 21 90 B4