View previous topic :: View next topic |
Author |
Message |
terryallen1981
Joined: 20 Aug 2007 Posts: 2
|
RS485 half duplex direction control |
Posted: Fri Aug 24, 2007 10:34 am |
|
|
What do I need to do to control the RS485 TX and RX direction with one PIC? I can setup the PIC to TX data or RX data. When I try to use one PIC to TX and RX I can TX but not RX, eventhough there is data on the PIC RX pin. Using a PIC16F876A and a SN65176BP transceiver.
Thanks in advance. |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Fri Aug 24, 2007 11:27 am |
|
|
Basically you should either TX or RX but not TX and RX at the same time. If you use one PIC pin to control the RS485-to-logic converter you should be OK. The #use statement for the serial port has a parameter to control the pin attached to the converter. |
|
|
Guest
|
|
Posted: Fri Aug 24, 2007 12:11 pm |
|
|
The driver and receiver have active-high and active-low
enables, respectively, that can be connected together externally to function as a direction control.
Tie the enables together and connect them to a pin from the PIC and let the #use rs232 control direction?
terryallen1981 |
|
|
ritchie
Joined: 13 Sep 2003 Posts: 87
|
|
Posted: Sun Aug 26, 2007 12:32 am |
|
|
Analyzing the given schematic below... you could be able to control the direction of TX and RX in RS485 communication without using any I/O pin from PICmicro.
Take note: the circuit is always in the receive mode and when it transmit data it will sample the transmitted data to trigger the direction of the RS485 pin.
I hope this helps coz I use this in one of my project before and it is working perfectly.
The image is hosted by: ImageShack for Free Image Hosting
^::^ |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Mon Aug 27, 2007 9:13 am |
|
|
With this circuit, won't you get the TX data looped back in the RX?
You Rx all the time and selectively tx. But when you tx won't that data
appear in the Rx? I would/do do it as guest suggested above. |
|
|
Ttelmah Guest
|
|
Posted: Mon Aug 27, 2007 9:36 am |
|
|
Yes. In fact it is slightly worse than that. With this circuit, you are only driving during the -ve (on the PIC) 'parts' of the serial waveform, and are reliant on the bus bias for the 'drive' during the other parts of the waveform. This will give slower edges, poorer noise rejection, and shorter range operation, than RS485 is really capable of...
The normal way of doing this, is to use a monostable multivibrator, triggered on the falling edge of the serial line, that then holds the buffer in transmit mode, for the entire 'byte time'. More sophisticated units, use something like an 8pin PIC, detect the incoming baud rate, and automatically adjust how long the driver is enabled for.
Best Wishes |
|
|
|