2009/5/12 Brent Brown : > On 11 May 2009 at 17:12, solarwind wrote: >> --- >> 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? > > No point in keeping both disabled, enable the receiver when you want to r= eceive, > enable the transmitter when you want to transmit. As the two enable lines= use > opposite logic it is quite common to tie the two enable lines together so= you only > need one control line from the micro... that way receiver is disabled when > transmitting, and when transmit is done you go back to listening to the b= us. Easiest > protocols have one master, slaves are not allowed to transmit until they = are > addressed and commanded to by the master. > -- > Brent Brown, Electronic Design Solutions > 16 English Street, St Andrews, > Hamilton 3200, New Zealand > Ph: +64 7 849 0069 > Fax: +64 7 849 0071 > Cell: +64 27 433 4069 > eMail: =A0brent.brown@clear.net.nz > > One way to slightly simplify reception is to use a checksum that is the 2's complement of the sum of the bytes sent. That way, on receive you just keep adding the bytes and if the total equals zero at the end, then then it's OK. (In this case the checksum is included in the calculation). As Brent says, it's common to tie the transmit and receive lines together and run as a common "transmit enable" control. You need to make sure that you don't disable the transmit side until all the bits have been shuffled out. It is possible to have a circuit to control this driven off the transmit data but at high speeds it gets a bit tricky to not loose part of the start bit. If you connect the enable line directly to the transmit signal (as suggested elsewhere) you loose either the pull-down or pull-up capability and are likely to get more bit errors. In theory you can keep the receiver enabled during transmit and use this to check on data corruption due to collisions & noise, but I've never had much success with getting this to work properly. We just either control transmit and receive together or just control the transmitter and ignore any data received while transmitting. RP -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist