Adjustment
14
Protocol for Communications via the RS-232 Interface
Frame Layout for Data Transmission
Transmitting Partner Characters (ASCII)
Receiving Partner
Frame Segment
Start character
/ (ASCII 47)
=>
Connect
Frame header
Length information
2 Byte
=>
Connect
Frame header
Command bytes
2 Byte
=>
Frame header
1
st
data byte
2 Byte
=>
Data information
User data
2
nd
data byte
2 Byte
=>
User data
..
..
=>
Data information
User data
n
th
Data byte
..
=>
Data information
User data
Checksum (BCC)
2 Byte
=>
Frame end
Stop bit
. (ASCII 46)
=>
Disconnected
Frame end
Calculating the Checksum BCC (Block Check Character)
The Checksum is generated from an EXOR frame operation.
Start Character
Length
Command
Data
Checksum
Stop character
/
02
0D
00
59
.
2FH
30H 32H
30H 44H
30H 30H
35H 39H
2EH
Data used to calculate the checksum
Calculating Example:
Program Example:
/ 2FH = 0010
1111
0 30H = 0011
0000
XOR
= 0001
1111
2 32H = 0011
0010
XOR
= 0010
1101
0 30H = 0011
0000
XOR
= 0001
1101
D 44H = 0100
0100
XOR
= 0101
1001
0 30H = 0011
0000
XOR
= 0110
1001
0 30H = 0011
0000
XOR = 0101
1001
=> Checksum = 59H
Start
Transmitting Frame = “/020D0059.” (Example)
Transmitting Frame Length=10 (in this example);
checksum = 0; n = 1;
as long as: n < (Transmitting Frame Lenght - 3)
Checksum = Checksum EXOR Transmitting
Frame charakter (n)
n = n +1
End