EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

RS232 or USB to RS485

Started by QBA February 11, 2004
To control RTS, I wrote my own program that uses DCB flag in one of those
Windows API calls. Definitely don't want to use HYPERTERMINAL to toggle RTS.
Have not measured exact timing yet, but it worked as I intended.

My original post was to find commercially avialable RS232-485 converter. We
have built in-house version of such a converter, but it takes longer to
build it internally than buy it somewhere else...

QBA

"David Brown" <david@no.westcontrol.spam.com> wrote in message
news:c0coie$k5o$1@news.netpower.no...
> > "Johnny" <john_wr@NOSPAM.hotmail.com.> wrote in message > news:2mnj20hpmai46rg41j1d9ujentjpif0nur@4ax.com... > > On Wed, 11 Feb 2004 07:13:55 GMT, Tauno Voipio > > <tauno.voipio@iki.fi.NOSPAM.invalid> wrote: > > > > >RS-232 to RS-485 needs two simple chips back-to-back: > > >RS-232 to logic (e.g. MAX232) and logic to RS-485 > > >(e.g. MAX485). The real problem comes from the control > > >of the RS-485 transmitter enable, if your interpretation > > >of two-wire RS-485 involves traffic in both directions > > >(which is 4-wire with transmit and receive bus lines > > >connected in parallel). > > > > > >There are simple boxes which contain the chips and > > >usually a simple power supply (e.g. a plug transformer, > > >'wall wart'). Usually, they are four-wire, but the > > >common bus two-wire is achieved by connecting the > > >RS-485 bus sides in parallel. The boxes often control > > >the transmit enable with the RS-232 RTS (request to > > >send) signal. > > > > > > I have found that the converters using RTS to enable are not very > > useful to me. It is not possible to use them with Hyperterminal in > > windows because when hardware handshaking is turned on, RTS is > > permenantly asserted, so bi-directional transfer is impossible. > > > > Personally, I have found Hyperterminal a real PITA, and highly
inconsistent.
> There are a hundred and one free terminal programs for windows that are
far
> better (and as many again commercial ones). At the risk of starting yet > another "my terminal program is better than your terminal program" thread, > I'd recommend "Tera Term Pro" for most serial work (because it is small, > fast, neat, and does what enough for most jobs without doing too much) and > "RealTerm" for more complex work (because it is big, powerful, with more > options than I could imagine needing). In particular, "RealTerm" supports > RTS control of RS-485 lines as you want here. > > > It is also not possible to use them with windows application, because > > it is impossible to know when to reset the RTS line, because the > > application has no way to know exacltly when all data has been > > transmitted out the serial port. > > > > It is perfectly possible to do exactly that - when setting the DCB flags
in
> a SetCommState api call, you can choose to have the RTS line permanently > high, or low, or hardware handshaking, or to have it active whenever there > is something being sent out and deactivated when there is nothing being > transmitted. It is simply a matter of choosing that flag, and your RS-485 > communication should work perfectly. I haven't done any measurements as
to
> the exact timings on the line, but I have found it far more reliable than > using so-called "intelligent" RS-485 adaptors. > > Now, if anyone can tell me how to get the same effect in linux, I'd be
most
> interested! > > David > > > > I think the only way to make a useful RS-232 to RS-485 adapter for > > windows is to use a hardware one-shot triggered by the start bit to > > control Transmit enable on RS-485 driver. Please let me know if I am > > wrong. > > > > regards, > > Johnny. > >
I do not know if there is any converter out there
but I do know that there is Communication Device Class firmware for the
AT89C5131.
It should be possible for someone to change this to RS485 I think.

-- 
Best Regards,
Ulf Samuelsson   ulf@a-t-m-e-l.com
This is a personal view which may or may not be
share by my Employer Atmel Nordic AB


"QBA" <ching_wang@REMOVE.THE.OBVIOUS.alltel.net> skrev i meddelandet
news:VRhWb.6312$QE3.894@fe01.usenetserver.com...
> I need RS232 to RS485 converter or USB to RS485 converter, are there
vendors
> out there you recommend for these converters? More specifically, RS485 I
am
> using is 2-wire (ground, don't need 4-wire version) at 19200 baudrate. > > >
"Paul Keinanen" <keinanen@sci.fi> wrote in message
news:bpnj205416p67cj294pikhgdfd8jauvfcj@4ax.com...
> On Wed, 11 Feb 2004 08:20:53 +0100, "Meindert Sprang" > <mhsprang@NOcustomSPAMware.nl> wrote: > > > > >Lately I see people here talking about 2-wire and 4-wire RS485. Isn't
RS-485
> >*always* 2 wire? > >If 4-wire, it's RS422, right? > > No. > > RS-422 is point to point with the transmitters always on. > > "4 wire RS-485" usually refers to a single RS-422 master (with Tx > always on) and multiple slaves with one pair constantly listening to > the master transmission on the master Tx pair, but the slave > transmitters can be tri-stated and all slave Tx chips are connected in > parallel to the master Rx pair. > > The master can communicate with a single selected slave at the time in > full duplex. Alternatively, the master can send broadcasts to all > slaves and simultaneously receiving data from a single slave.
Thanks for that very clear explanation. The 4-wire RS485 is something I never thought of. It has indeed its advantages. Meindert
QBA wrote:
> I need RS232 to RS485 converter or USB to RS485 converter, are there vendors > out there you recommend for these converters? More specifically, RS485 I am > using is 2-wire (ground, don't need 4-wire version) at 19200 baudrate.
Not only do they make every imaginable converter, but they have good tutorials on all this RS232/422/485 stuff- http://www.bb-elec.com -- Gary Peek mailto:mylastname@mycompanyname.com Industrologic, Inc. http://www.industrologic.com Phone: (636) 723-4000 Fax: (636) 724-2288
On 2004-02-11, Meindert Sprang <mhsprang@NOcustomSPAMware.nl> wrote:

> Lately I see people here talking about 2-wire and 4-wire RS485. Isn't RS-485 > *always* 2 wire?
No. If you use separate RS485 driver/receiver chips and two pairs, then it's four wire.
> If 4-wire, it's RS422, right?
Not quite. IIRC, there are some minor differences in the electrical specs. RS-422 often won't allow multi-drop, and is strictly a point-to-point connection. -- Grant Edwards grante Yow! You should all JUMP at UP AND DOWN for TWO HOURS visi.com while I decide on a NEW CAREER!!
Grant Edwards <grante@visi.com> wrote:
> On 2004-02-11, Meindert Sprang <mhsprang@NOcustomSPAMware.nl> wrote:
> > Lately I see people here talking about 2-wire and 4-wire > > RS485. Isn't RS-485 *always* 2 wire?
> No. If you use separate RS485 driver/receiver chips and two > pairs, then it's four wire.
I don't agree this would mean "it" (RS485) is 4-wire, then. It's really two independent RS485 links, using 2 wires each. The fact you're not using full-fledged transceiver chips on your nodes is not a feature of the RS485 line protocol as such --- it's a detail of the particular application. You wouldn't call a bundle of ten classical coaxial Ethernet cables used to connect ten machines to ten other ones a "10-coax Ethernet" connection either, would you? -- Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.
On 2004-02-11, Johnny <john_wr@NOSPAM.hotmail.com> wrote:


> It is also not possible to use them with windows application, > because it is impossible to know when to reset the RTS line, > because the application has no way to know exacltly when all > data has been transmitted out the serial port.
Doesn't the "standard" windows serial port driver have an RTS-toggle feature? I know the Windows serial drivers we did at a previous employer did. -- Grant Edwards grante Yow! Th' MIND is the Pizza at Palace of th' SOUL visi.com
On 2004-02-11, Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> wrote:

>> No. If you use separate RS485 driver/receiver chips and two >> pairs, then it's four wire. > > I don't agree this would mean "it" (RS485) is 4-wire, then. > > It's really two independent RS485 links, using 2 wires each.
True (from an electrical point of view). But out in industry, that's called "4-wire RS-485", and it's quite common. It's usually used for a single-master, multiple slave system. The master transmits on one pair, the slaves on the other.
> You wouldn't call a bundle of ten classical coaxial Ethernet cables > used to connect ten machines to ten other ones a "10-coax Ethernet" > connection either, would you?
You misunderstand. The two pair in 4-wire rs-485 aren't used to connect two machines to two other machines. The two pair form a single bus with one master and multiple slaves. Electrically, it may be two RS-485 busses. Logically, it's a single, 4-wire bus that happens to use RS-485 transceivers. -- Grant Edwards grante Yow! I decided to be JOHN at TRAVOLTA instead!! visi.com
"QBA" <ching_wang@REMOVE.THE.OBVIOUS.alltel.net> wrote in message news:<VRhWb.6312$QE3.894@fe01.usenetserver.com>...
> I need RS232 to RS485 converter or USB to RS485 converter, are there vendors > out there you recommend for these converters? More specifically, RS485 I am > using is 2-wire (ground, don't need 4-wire version) at 19200 baudrate.
OTS RS232-to-RS485 at BestBuy works fine, lasts a long time. Also check BlackBox. Ken
"QBA" <ching_wang@REMOVE.THE.OBVIOUS.alltel.net> wrote in message news:<VRhWb.6312$QE3.894@fe01.usenetserver.com>...
> I need RS232 to RS485 converter or USB to RS485 converter, are there vendors > out there you recommend for these converters? More specifically, RS485 I am > using is 2-wire (ground, don't need 4-wire version) at 19200 baudrate.
did you do a web search? There's squilions of the things out there. I've used Advantech converters, seem OK http://www.advantech.com/products/Model.asp?Category_ID=1-D6FGJ&bu=

The 2024 Embedded Online Conference