
APPENDIX
Protocol Data Mode
96
2.10
•
19.01.2007
5.1.4.2 Transparency
The byte value 0x7E is reserved for the flag field of the HDLC frame (see section 5.1.2). If
any of the address, data or FCS fields contains a byte with value 0x7E, it must be removed
prior to transmission in order to avoid misinterpretation as flag field by the receiver.
The following transparency algorithm is used:
A)
Transmitting side
A complete HDLC frame is assembled (including FCS).
The byte sequence between the two flag fields is checked for any occurrence of values 0x7D
or 0x7E. Any byte 0x7D is replaced with the 2-byte sequence 0x7D 0x5D. Any byte 0x7E is
replaced with the 2-byte sequence 0x7D 0x5E.
The resulting byte sequence is transmitted. Depending on the data content of the frame, the
frame length has been enlarged by the transparency algorithm.
B)
Receiving side
The received byte sequence is scanned for the first occurrence of a flag field (0x7E). This
marks the start of the frame.
The following bytes are assembled into the HDLC frame. Any byte sequence 0x7D 0x5D
results in a single byte 0x7D to be assembled into the HDLC frame. Any byte sequence
0x7D 0x5E results in the single byte 0x7E to be assembled into the HDLC frame.
The next occurrence of a flag field in the received byte sequence marks the end of the
frame. It may also indicate the start of a following frame.
The completely received HDLC frame is then further processed (e.g. the FCS is verified).