ZBus Protocol

Aus Ethersex_Wiki
Version vom 20. Oktober 2010, 02:27 Uhr von Dangu (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche

ZBus is a protocol to transfer packets over an serial line, where only one byte can be sent at once, e.g. RS485. The problem with such a serial line is, that every byte is independend from another byte. So you have to define a format for a packets, in which you can chain many bytes together, in order send more information than just one byte. ZBus is such an format.

ZBus is a little bit related to I2C: There is an start condtition at the beginning of a packet and a stop conditon at the end. Between start and stop condtiontion is no field that represents the length of the packet.

The start condition is an '\' (0x5C) followed by an '0' (0x30). Corresponding to that is the stop condition an '\' (0x5C) followed by an '1' (0x31). But we also have to escape all '\' (0x5C) inside the packet, so that a start condition can't happen at random. ZBus does this in the normal Unix way by replacing every '\' with an '\\'

A packet can for example look like this:

\0get information about \\0 and \\1 in zbus\1

The plain message would be:

get information about \0 and \1 in zbus