Anda di halaman 1dari 2

File: pbus Desc: RS485-like multi-drop bus with half duplex serial protocol PBUS is a rs485-like multi-drop bus

for interconnecting PIC and other microcontroller-driven devices. There are three source versions: PB12 is for 12-bit slave devices without interrupt PBUS is for slave devices with an interrupt, software UART implementation PB628 is for slave devices with an intterupt and a free hardware UART PBUS assigns a unique device ID in the range 1-f for every controller on the bus. The maximum number of slave devices on one bus is maximized in 15. The implementation uses 2400 baud half-duplex serial communication. Only 2 wires (GND and PBUS signal) are needed to interconnect devices using their own power supply. Packet structure Packets consist of 8-bit bytes. All packets contain at least 3 bytes. Maximum length is 18 bytes. byte byte byte byte byte sum offset 0, upper 4 bits: DEVID, destination device PBUS ID offset 0, lower 4 bits: LEN, optional data length (0 means 3 byte packet) offset 1: CMD, MASTER command or SLAVE response code offset 2: optional data, length is given in LEN (LEN=0 means no data) offset 2+LEN: packet checksum. Added to the packet bytes will result a of zero

PBUS timings Master devices generates a 8500 usec gap on the bus before transmitting a PBUS packet. This is for synchronization of all listening receivers. Receivers can expect to see a min. 4900 usec, max. 21200 usec gap. Packet bytes must be sent without interruption. Packet reception will be reset if a gap longer than 200 usec is detected. After the request packet is sent, the master waits up to 1000 usec for a reply from the addressed slave. Slaves check received packets in this order: check for a valid checksum. If invalid, drop packet and go back listening check for own device ID. Ignore all other IDs without response if the command is not implemented, ignore the packet and go back listening process the command and generate a response with a destination device ID 0

PBUS commands PBUS handlers will implement some commands internally. Commands implemented by ALL sources: M: CVER (check node version) S: ROK <pbus version> [main version] [optional string describing node] current nodes do not return the optional string by default

M: CPING [optional data] (test if a node is present and the link is up) S: RECHO [optional data echoed] PB12 sources will not echo the supplied ping data back Commands implemented by sources expect PB12: M: CNOOP (no operation) S: ROK M: CLAST (repeat last response) S: (copy of the last response packet sent) M: CRES (reset statistics counters) S: ROK M: CSTAT (get PBUS statistics) S: ROK <e1> <e2> <e3> [optional counters] The CRES and CSTAT commands can be disabled. Meaning of counters: e1 = number of checksum errors e2 = number of good packets received e3 = number of good packets sent for me (not necessarily answered) Hardware interfaces for PIC devices Hardware interfaces for PC serial port Hardware interfaces for 4-wire RS485

Anda mungkin juga menyukai