5.3 Modbus RTU
5-41
Chap. 5 USING STANDARD RS-485
5.3.3.2 CRC-16 algorithm
The following diagram shows the CRC-16 calculation algorithm. Please also refer to the calculation
example in Section 5.3.3.3.
CRC DATA is 1 word of memory. It is updated in the calculation process and finally added to the
sent frame as a check code.
When the message is received, the same algorithm is used. The CRC calculated at the receiving side
must then be cross-checked with the CRC that was sent.
初期設定
余り R ← "FFFF"
生成多項式 P ← "A001"
データ長カウンタ n ← 0
データ長計算 N←データ長
n == N?
n++
A = n番目の送信バイトを
ワードデータの下位バイトに設定
上位バイトは"00"
CRC DATA ← CRC DATA XOR A
Shift Count == 8?
Shift Count++
No
Yes
Bitシフト キャリー有り?
No
CRC DATA ← CRC DATA XOR P
Shift Count == 0?
Yes
No
Shift Count ← 0
Yes
CRC DATAを
送信フレーム最終段に付加
END
START
Yes
n == 1?
CRC DATA ← A XOR R
No
Yes
No
CRC DATA >> 1bitシフト
Default
Remainder R “FFFF”
Generating polynomial P “A001”
Data length counter n 0
Data length calc. N
Data length
Specify last byte of word data as:
A = n
th
sent byte
Top byte is “00”
CRC DATA >> 1 bit shift
Bit shift Carr
?
dd CRC DAT
to last level of
sent frame