NEC X981UHD External Control Codes - Page 13

Check code

Page 13 highlights

4.3 Check code Header Message Check code Delimiter Check code is the Block Check Code (BCC) between the Header and the End of Message except SOH. SOH D0 Reserved D1 Destination D2 Source D3 Type D4 Length(H) D5 Length(L) D6 STX D7 Data D8 | | | | ETX Dn Check code Dn+1 Dn+1 = D1 XOR D2 XOR D3 XOR ,,, Dn XOR: Exclusive OR 27 26 25 24 23 22 21 20 P P P P P P P P Following is an example of a Check code (BCC) calculation. SOH Reserved Destination Address Header Source Message Address type 01 30 41 30 45 D0 D1 D2 D3 D4 Message length 30 41 D5 D6 Message STX OP code OP code page Set Value Check Delimiter ETX code (BCC) 02 30 30 31 30 30 30 36 34 03 77 0D D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18 Check code (BCC) D17 = D1 xor D2 xor D3 xor ... xor D14 xor D15 xor D16 = 30h xor 41h xor 30h xor 45h xor 30h xor 41h xor 02h xor 30h xor 30h xor 31h xor 30h xor 30h xor 30h xor 36h xor 34h xor 03h = 77h (13/130)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130

(13/130)
4.3 Check code
Check code is the Block Check Code (BCC) between the Header and the End of Message except SOH.
D
n+1
= D
1
XOR D
2
XOR D
3
XOR ,,, D
n
XOR: Exclusive OR
Following is an example of a Check code (BCC) calculation.
Check code (BCC) D
17
= D
1
xor D
2
xor D
3
xor … xor D
14
xor D
15
xor D
16
= 30h xor 41h xor 30h xor 45h xor 30h xor 41h
xor 02h xor 30h xor 30h xor 31h xor 30h xor 30h
xor 30h xor 36h xor 34h xor 03h
= 77h
Header
Message
Check code
Delimiter
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
SOH
D
0
Reserved
D
1
Destination
D
2
Source
D
3
Type
D
4
Length(H)
D
5
Length(L)
D
6
STX
D
7
Data
D
8
|
|
|
|
ETX
D
n
Check code
D
n+1
P
P
P
P
P
P
P
P
Header
Message
Check
code
(BCC)
Delimiter
SOH
Reserved
Destination
Address
Source
Address
Message
type
Message length
STX
OP code
page
OP code
Set Value
ETX
01
30
41
30
45
30
41
02
30 30 31 30 30 30 36 34
03
77
0D
D
0
D
1
D
2
D
3
D
4
D
5
D
6
D
7
D
8
D
9
D
10
D
11
D
12
D
13
D
14
D
15
D
16
D
17
D
18