7 3a) Packet layer bytes are transmitted back-to-back OpcodeDataCheck...bytes are transmitted back-to-backpackets consist of 2, 4, 6 or N bytesfirst byte is „opcode“last byte is checksum (xor of all other bytes).
8 3b) Opcode D7 D6 D5 D4 D3 D2 D1 D0 5 bits to encode 32 possible opcodes.always 1 (all other bytes have D7=0)6 bytes14 bytesN bytes2 bytespacket length(including opcode and checksum)
9 3c) Packet timing, net access CD20bit timesMD6PD0..20.CD: carrier detect (defines end of packet)MD: master delay (only master may transmit)PD: priority delay (high prio. = small PD)
10 3d) Packet timing, collisions Collisions are avoided, by shortening the time between still observing the net is idle until the first bit is transmitted onto the net.Collision is detected, when a 0 is seen on the net, while a 1 is being transmittedOn detection of a collision, a break (15 bit times 0) is transmitted.
12 5a) Loco operation Table with loco data in command station Slot # = Index in table = HandleSlot # is a 7 bit number128 Slots:are loco slots0 dispatch slot>120 are special slots (fast clock, programming)loco slots have fields:
13 5b) Fields of a slot loco address (14 bits) state of slot (free/common/idle/IN_USE)protocol selection (# of speed steps, ...)state of locospeed (7 bit)functions (9 bits, F0, F1, ..., F8)consist treeID (14 bits, can be a device ID of controller)
14 5c) Operations on slots (requests) requests to master:OPC_LOCO_ADR: get slot by addressOPC_RQ_SL_DATA: get slot by slot #OPC_WR_SL_DATA: write slot by slot #OPC_MOVE_SLOTS: move slot from # to #dispatch put (destination=0)dispatch get (source=0)NULL move (source=destination!=0)OPC_SLOT_STAT1: modify slot status
15 5d) Operations on slots (responses, operation) responses from master:OPC_LONG_ACK: simple acknowledgeOPC_SL_RD_DATA: slot datarealtime operationOPC_LOCO_SPD: 7 bits of speedOPC_LOCO_DIRF: direction and F0, ..., F4OPC_LOCO_SND: F5, ..., F8
16 6a) FRED FRemos Einfacher Drehregler Simple to use Can only control one enginespeed,direction,F0, F1, F2.
17 6b) FRED: Example for protocol (acquire loco) masterFREDmasterFREDDispatch GetDispatch GetSlot ReadNACK.Write SlotACK
18 6c) FRED: Example of protocol (reconnect) masterFREDmasterFREDif slot data changedGet SlotBy AddressNull MoveSlot ReadSlot ReadWrite SlotACK.