User's Manual

i-PORT MB – Manual
Version 1.1 02.02.2007 Page 17/
37
4.0 COMMUNICATION PROTOCOL
4.1
Telegram Structure, Escaping and CRC
Operation of the i-PORT MB follows strictly the Master/Slave principle. Readers are slaves and there is no
information sent by the readers unless requested by the master computer.
The data is divided into separate messages with the following structure:
SOH Addr Cmnd data ... Crc16 EOT
SOH and EOT are the ASCII characters 0x01 and 0x04, respectively.
Addr is the bus address of the telegram recipient.
Cmnd represent the command ID or response ID.
Data represent the Command specific information.
Crc16 is the telegram cyclic redundancy check.
Bus communication
The bus has only 1 master and various slaves uniquely identified by a bus address.
Communication can only occur between the master and 1 of the slave. There is no direct
communication possible between 2 slaves.
The bus address in a telegram identifies the recipient if sent by master or the sender if sent by
slave.
Addresses 0xF0 up to 0xFD are reserved.
0xFF is the broadcast address.
0xFE addresses any reader which has its slave port disconnected which give an opportunity to communicate
with the last reader connected on the bus. This functionality is used to discover readers on the bus.
Starting at addresses >= 0x11 is recommended to avoid the need for escape sequences for the device
address.
Addresses 0x30 (‘0’) or 0x41 (‘A’) might be convenient values to start with. Commands sent to the broadcast
address cause no response unless otherwise noted. A reader addressed with 0xfe responds with its assigned
short address (as opposed to 0xfe) in its response telegram.
Escape sequences
As the protocol is binary and does not contain length information some special characters must be “escaped”
in order to allow correct reception and decoding. This is done by adding a DLE- (0x10) character and adding
binary 0x80 to the character being escaped. These characters and the corresponding escape sequences are:
Character Code Escape sequence
SOH 0x01 0x10, 0x81
EOT 0x04 0x10, 0x84
DLE 0x10 0x10, 0x90
This encoding is done after the CRC is added; removing on the receiving side must be done
before the CRC is checked.