text
stringlengths
0
99.6k
The Sequence is incremented by one for each successfully
transmitted packet. It wraps from 0x39 back to 0x30. (Note
that 0x30 is the ASCII character 0 and 0x39 is 9.)
The Sequence, Type, all Body data, and <ETX> are included in
the Check Value. Note that <Body> and <Check Value> are
Quoted, and that the Check Value is computed on the actual
data bytes rather than their quoted replacements (the
quoting <DLE> is not included). Hence, if the character
0x13 is to be sent, it is sent as <DLE> <S> but the value
0x13 is included in the Check Value.
If Standard Checksum is used, <Check Value> consists of a
quoted byte.
If the XMODEM CRC-16 is used, <Check Value) is transmitted
as two quoted bytes with the most significant byte appearing
first. By performing the CRC calculation on the XMODEM
CRC-16 value, the result will be 0x0000 if no errors
occured.
A sample B Plus packet, sent using the Standard Checksum, is
as follows:
<DLE> B 7 T D A S . C <ETX> 0x2A
0x10 0x42 0x37 0x54 0x44 0x41 0x53 0x2E 0x43 0x03 0x2A
where
Lead-in = <DLE> B
Sequence = 7
Type = T
Body = DAS.C
Trailer = <ETX> 0x2A
If the packet was sent using the XMODEM CRC-16 option, the
Check Value would be 0x57 0xFF instead of 0x2A.
4
2. Quoting of characters.
The B Plus Protocol quotes certain ASCII control characters.
The default set of quoted characters is:
o <ETX> 0x03
o <ENQ> 0x05
o <DLE> 0x10
o <DC1> 0x11
o <DC3> 0x13
o <NAK> 0x15
The quoting mechanism uses the <DLE> character to prefix the
quoted character. The quoted character with 0x40 added
follows the <DLE>. For example, <ETX> is quoted as:
<DLE> C
0x10 0x43
B Plus also provides a means for the Initiator and Responder
to establish a different set of quoted characters. This set
may consist of any or all characters in the ranges 0x00 thru
0x1f and 0x80 thru 0x9f.
Quoted characters in the 0x80 thru 0x9f range are sent as:
<DLE> ((char and 0x1f) + 0x60)
Hence, 0x93 is quoted as:
<DLE> s
0x10 0x73
When receiving protocol data, the program should be capable
of decoding any quoted character, regardless of the set of
quoted characters in use. This must be accomplished as
follows:
Get a character.
If the character is <DLE>
then
Get next character.
If character is less than 0x60
then
character = character and 0x1f
else
character = (character and 0x1f) + 0x80