IDEC FC6A-C16K1CE Communications Manual page 125

Fc6a series microsmart all-in-one type
Hide thumbs Also See for FC6A-C16K1CE:
Table of Contents

Advertisement

BCC Calculation Examples
The FC6A Series MicroSmart can use three new BCC calculation formulas of ADD-2comp, Modbus ASCII, and Modbus RTU for
transmit instructions TXD1, TXD2 and TXD3 and receive instructions RXD1, RXD2 and RXD3. These block check characters are
calculated as described below.
ADD-2comp
Add the characters in the range from the BCC calculation start position to the byte immediately before the BCC, then invert the
result bit by bit, and add 1.
Add the characters in the range from the BCC calculation start position to the byte immediately before the BCC.
1.
Invert the result bit by bit, and add 1 (2's complement).
2.
Store the result to the BCC position according to the designated conversion type (Binary to ASCII conversion or No conversion)
3.
and the designated quantity of BCC digits.
Example: Binary to ASCII conversion, 2 BCC digits
When the result of step
Modbus ASCII — Calculating the LRC (longitudinal redundancy check)
Calculate the BCC using LRC (longitudinal redundancy check) for the range from the BCC calculation start position to the byte
immediately before the BCC.
Convert the ASCII characters in the range from the BCC calculation start position to the byte immediately before the BCC, in
1.
units of two characters, to make 1-byte hexadecimal data. (Example: 37h, 35h → 75h)
Add up the results of step 1.
2.
Invert the result bit by bit, and add 1 (2's complement).
3.
Convert the lowest 1-byte data to ASCII characters. (Example: 75h → 37h, 35h)
4.
Store the two digits to the BCC (LRC) position.
5.
If the BCC calculation range consists of an odd number of bytes, the BCC calculation results in an indefinite value. Modbus
protocol defines that the BCC calculation range is an even number of bytes.
Modbus RTU — Calculating the CRC-16 (cyclic redundancy checksum)
Calculate the BCC using CRC-16 (cyclic redundancy checksum) for the range from the BCC calculation start position to the byte
immediately before the BCC. The generation polynomial is: X
Take the exclusive OR (XOR) of FFFFh and the first 1-byte data at the BCC calculation start position.
1.
Shift the result by 1 bit to the right. When a carry occurs, take the exclusive OR (XOR) of A001h, then go to step 3.
2.
If not, directly go to step 3.
Repeat step 2, shifting 8 times.
3.
Take the exclusive OR (XOR) of the result and the next 1-byte data.
4.
Repeat step 2 through step 4 up to the byte immediately before the BCC.
5.
Swap the higher and lower bytes of the result of step 5, and store the resultant CRC-16 to the BCC (CRC) position. (Example:
6.
1234h → 34h, 12h)
2
is 175h, the BCC will consist of 37h, 35h.
FC6A S
M
S
A
ERIES
ICRO
MART
LL
5: U
16
15
2
+ X
+ X
+ 1.
-
-O
T
C
IN
NE
YPE
OMMUNICATION
C
SER
OMMUNICATION
M
FC9Y-B1730
ANUAL
I
NSTRUCTIONS
5-49

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents