The way I use that transceiver is to allow only ONE master to issue commands, and everyone on the network listens. Then the INTENDED slave (ONLY) answers. So sometimes a slave may not be interrogated for hours. My communications protocol is simple: the first byte is the DESTINATION (intended slave) , the next byte is the COMMAND, and data pertaining to that data follows. To make sure the slaves received the command correctly, there is a CHECKSUM byte (or bytes) sent that represent a simple sum of all characters in the message (except the checksum chars themselves). All slaves monitor the checksum, and if they receive a bad checksum, they must IGNORE the message because its data was corrupted. It might sound difficult, but in fact it is very simple to implement. Even a better checksum scheme, such as CRC8 or CRC16 can be used to improve reliability; with CRC16 you can send data on telephone lines for 1000 meters or more with very few repeats(if the slave fails to respond, you REPEAT the command). --Bob A On Mon, May 11, 2009 at 2:12 PM, solarwind wrote: > Hey all. I just got 10 samples of MAX485 (half duplex RS485 > transceiver) today. I want to try and make a simple multi master > network using RS485 and PICs with hardware UARTs. Can anyone recommend > where I can get started in terms of the protocol? > > I need a protocol driver for PICs or at least some information on how > to implement my own. I have a general idea on how to send data between > PICs but the largest concern is collision. I don't know how to > implement collision detection/avoidance. How do you check if the line > is busy anyway? > > Also, the MAX485 has a receiver enable and driver enable pins. This is > what the data sheet says: > > --- > RE: Receiver Output Enable. RO [sends data INTO the PIC] is enabled > when RE is low; RO is > high impedance when RE is high. > > DE: Driver Output Enable [sends data OUT from the PIC]. The driver > outputs, Y and Z, are enabled > by bringing DE high. They are high impedance when DE is low. If > the driver outputs are enabled, the parts function as line drivers. > While they are high impedance, they function as line receivers if > RE is low. > --- > > So does this mean that the receiver and the driver should be kept in > high impedance when I'm not doing anything? If it does, then how do I > know when I should enable the receiver? > > -- [ solarwind ] -- http://solar-blogg.blogspot.com/ > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist