58 of 135
Example FCS calculation for RS-232C
FCS is the result of the horizontal parity calculation (Exclusive OR) of the data right after SOH to the end of the
Command data.
An example of FCS calculation:
Command code and Command data:
RDID –seq MOC –ant 1 –tmo 500
FCS value:
19
Command frame:
[SOH]RDID –seq MOC –ant 1 –tmo 500
19
[CR][LF]
Command code
Command data
SOH
R D I D -
s e q M O C
-
a
n
t
1
- t m o
5
0
0
01 52 44 49 44 20 2D 73 65 71 20 4D 4F 43 20 2D 61 6E 74 20 31 20 2D 74 6D 6F 20 35 30 30
FCS CR LF
31 39
0D
0A
Calculation
Character ASCII
Code
(Hex) Binary
R 52
01010010
D 44
01000100
I 49
01001001
D 44
01000100
(Space) 20 00100000
- 2D
00101101
s 73
01110011
e 65
01100101
q 71
01110001
(Space) 20 00100000
M 4C
01001100
O 4F
01001111
C 43
01000011
(Space) 20 00100000
- 2D
00101101
a 61
01100001
n 6E
01101110
t 74
01110100
(Space) 20 00100000
1 31
00110001
(Space) 20 00100000
- 2D
00101101
t 74
01110100
m 6C
01101100
o 6F
01101111
(Space) 20 00100000
5 35
00110101
0 30
00110000
0 30
00110000
XOR
19
00011001
“19” is translated to “31” and
“39” as ASCII code.