Thus the datapackets were defined as :
|1||SYN (0x16)||required, as the 1st startbit is missing|
|2||STX (0x02)||start of message|
|3||LEN||length of the packet including STX & CRC|
|4||SRC||ID of the sender|
|5||DST||ID of the reciever|
|7||[data]||optional data field|
|8||CRCHi||high byte of CRC16|
|9||CRCLo||low byte of CRC16|
Each node listens to all packets and processes those adressed to itself. If broadcasting is required, the ID 0xFF may be reserved for broadcasts. The receiver interrupt is a state machine :
|0||idle, wait for STX|
The main program polls for state 3. Then checks the CRC. If the CRC is wrong, the packet is discarded. If the CRC is correct, it then checks the ID and processes the packet in case the ID matches. The ID check and the CRC check may be exchanged, that may save some CPU time.
The mentioned packet format and its processing enable a save transmission on a multipoint bus system.
A normal device, meaning a slave, sends only one or more packets when requested from the master to do so. If there is a reply to every packet, the master is able to detect a missing packet.
Required strategies :
If there are multiple masters, some administration has to be added.
Usually a token is passed between the masters. Only the master with the token is the master of the bus at the current time. This means the master have to know each other, by a fixed ID or some other mechanism. What happens when token becomes lost ? A token recovery scheme has to be implemented.
When the network configuration is allowed to change over time, the network has to be polled from time to time, not to detect missing devices, but to find newly connected devices.
When there are more devices than ID's to be dynamically connected, a dynamic ID scheme has to be implemented.
last updated: 12.april.00