| ??? 11/05/03 15:53 Read: times |
#57900 - RE: 485 advise, since there is 2 threads Responding to: ???'s previous message |
Shahzad,
One method that I have used in the past, is to do the following: - Define a character that will be sent out when transmitting a message. For exmaple 'B' (for busy) Each message would look like this: [Bxxxxxxxxxxxxx<CR><LF>] xx...x is the message. The 'B' is the beginning of the message and the <LF> is the end of the message. Upon recieving a 'B' all units cannot transmit until a <LF> is recieved. Of course this opens a whole can of worms, because if you have multiple units that can be masters, as you have described, now you have to worry about what happens when two units are accessed at the same time. - This can be minimized, but not prevented, by the following scheme: START: - Wait a random delay of N msec - Check to see if the BUSY flag is set - If the BUSY flag is set goto START - If the BUSY flag is clear,send message In this way, the two users would have to try to access the system at exactly the same time within microseconds of each other to cause a collision on the RS-485 bus. Jacob |



