Serial protocol

Communication protocol consists of two main commands: read memory byte and write memory byte. It could contain also some special commands which are specially described for every device. Protocol is based on 5-byte binary packets exchange. The device sends 5-byte answer for every 5-byte command, if device address field in this command is correct.
Command structure is following:

Byte Description
1 6-bit device address. Should be equal to device address set on the dip switch inside the device or packet will be ignored otherwise. Two most significant bits are ignored.
2 Bit 7 – read/write bit. Bit 7 = 1 corresponds to write command and bit 7 = 0 – read command.
Bit 6 – special command flag. If bit 6 = 1, packet contains special command.
Bits 5÷0 – high bits of 14-bits address field.
3 Low byte of 14-bits address field.
4 Data byte.
5 XOR-sum of first 4 bytes. B5=B1^B2^B3^B4. If it is not correct XOR-sum, packet is ignored.

Examples:
1. Host computer wants to read byte at address 0x345 from the device with address 0x02. Device memory contains 0xAA at this address.

 host request  : 0x02 0x03 0x45 0x00 0x44
device answer : 0x02 0x03 0x45 0xAA 0xEE

2. Host computer wants to write byte 0x55 at address 0x1543 to the device with address 0x08 (Note that read/write bit is cleared in the answer).

host request  : 0x08 0x95 0x43 0x55 0x8B
device answer : 0x08 0x15 0x43 0x55 0x0B

Communication speed could be selected from 9.6, 19.2, 57.6 or 115.2 Kbit/s by dip switch inside the device (see table below). Usually read or write access to the device memory using this protocol takes not more than 2ms for every byte at 115.2 Kbit/s. Memory map is of course different for every device and is specially described as well as additional commands. Byte ordering is little endian, high byte has low address.

Configuration switch:

Switch position Description
1-6 6-bit device address in binary format. Least significant bit is selected by switch position 1. Valid range is 1÷63.
7-8 Communication speed:
00 – 9600 bit/s
01 – 19200 bit/s
10 – 57600 bit/s
11 – 115200 bit/s

Temperature monitor accepts one special command, with byte 2 = 0x41. In response to this command it sends all temperatures as word[128] array and one byte of XOR-sum in the end (257 bytes totally). This command is fastest way to get all temperatures from the device. At 115200 bit/s communication speed it takes about 30ms, while reading by one memory byte takes about 400ms.

Tags: