Skip to content

Message protocol

IoliteCoding edited this page Aug 5, 2024 · 2 revisions

Every piece of the message is made out of a byte (8 bits).
If we just sent text, this will be translated to the byte representation of that character (ASCII) even if it is a decimal number.
For example 0 -> 9 is in ASCII: 48 -> 57.

In the commands we will use the whole byte, not the ASCII representations.
The minimum value of a byte is 0 and the maximum is 255.

The whole command is wrapped between a start byte and a stop byte:

128 64 32 16 8 4 2 1 Decimal Hex
1 1 1 1 1 1 1 0 254 0xFE Start
1 1 1 1 1 1 1 1 255 0xFF Stop

This means that 0xFE and 0xFF cannot be used as a value in the message.

Structure of a command

see: Command Structure

Limitations

One of the limitations is that 0xFE and 0xFF cannot be used as a value in the message length, the address or the data.
So the message length cannot exceed 253 bytes (address & data).

- Impact on the addresses

The default limit on the addresses is 200 (from 0 - 199). This is already a lot of possible addresses but if for some reason the number of addresses exceeds this number or there are empty spaces in the addresses, it is possible to enlarge the address length (see todo).

Every address byte will count until 199. If the address exceed this, this will overflow in the next byte.
With 2 address bytes this goes already to 39999. For example:

  • 316 -> minimum 2 address bits -> 0x01 (1) 0x74 (116) -> (1 * 2001) + (116 * 2000)
  • 605 -> minimum 2 address bits -> 0x03 (3) 0x05 (5) -> (3 * 2001) + (5 * 0)
  • 456703 -> minimum 3 address bits -> 0x11 (11) 0x53 (83) 0x67 (103) -> (11 * 2002) + (83 * 2001) + (103 * 1)

Clone this wiki locally