p29
11111111
byte 3
11111111
byte 4
111 0 11 0 0
byte 1
0 1111 0 0 0
byte 2
0 0 0 0 0 0 0 0
byte 3
0 0 0 0 0 0 0 0
byte 4
0 0 0 1 0 0 11
byte 1
1 0 0 0 0 111
byte 2
0 0 0 0 0 0 0 0
byte 3
0 0 0 0 0 0 0 0
byte 4
0 0 0 1 0 0 11
byte 1
1 0 0 0 1 0 0 0
byte 2
0
0
19
136
Sign
: 1 negative: reversing of the bits and plus 1.
Plus 1
Reverse
Measure = byte 3 x 2563+ byte 4 x 2562 + byte 1 x 256 + byte 2
= 0 x 2563 + 0 x 2562 + 19 x 256 + 136
= 5000
Reading of the address 120 => decimal point = 2 => displayed measure:
50.00
254
3
4
236
•
Response with a negative measure
:
120
255
CRC 16
255
measure
byte 1
byte 2
byte 3
byte 4
2 bytes
Measure = -(byte 3 x 2563+ byte 4 x 2562 + byte 1 x 256 + byte 2)
= -(0 x 2563 + 0 x 2562 + 19 x 256 + 136)
= -5000
Reading of the address 120 => decimal point = 2
=> displayed measure: -50.00
9.5 CRC 16 calculation algorythm:
FFFF
→
CRC
CRC
⊕
BYTE
→
CRC
END
yes
no
n = 0
n = n + 1
yes
no
shifting by one byte to
the right of CRC
carry
CRC
⊕
poly
→
CRC
n > 7
next byte
yes
no
Note 1
:
⊕
= exclusive or.
Note 2
: POLY = A001 (hex).
Note 3
:
The CRC16 calculation applies to all bytes in the sequence (except CRC16).
Note 4
:
Caution! In the case of CRC 16, the 1st sent byte is the LSB.
Example
: Sequence = 1-3-0-75-0-2 CRC16 = 180-29 (the values are decimal).
end of SEQUENCE