RS-232 levels to computer

Mar 10, 2006 40 Replies

Hi All,



I understand that standard RS-232 levels must be bipolar with at least a -3V for a logic "1" and +3 volts for logic "0".



The micocontroller 232 level is TTL level, I use this signal to drive a NPN so the the signal is inverted and use +12 on the collector to get the level. The lowest voltage out of the NPN will be near zero. I am using this for just collecting some data sent over a small cable lengh and I don't plan on this being part of a design.



The question is in regards to the computer RS-232 input, would the near zero voltage be taken as by the com port as the correct level?



Tnx de PDRUNEN



Yes. (Most RS232 ports don't actually follow the spec.)

...Jim Thompson

| James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC\'s and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | | http://www.analog-innovations.com | 1962 | It\'s what you learn, after you know it all, that counts.

Maybe, maybe not. I you want to be sure make it go negative like it\'s supposed to. Or try it the way you\'ve got it rigged and see if it works. Who knows, you might luck out...

...driven into a 1k load, or something like that.

In many (even most) cases, yes, but if you're designing this as as real product (not just a one-off device for yourself & friends), in a room full of miscellaneous computers you can assuredly find a machine that *won't* accept ground as being a logical 1. (It tends to be more older computers.)

For a real product, I would just use a Maxim 3311E and know I'm meeting the spec.

---Joel Kolstad

All the technical spec's suggest it shouldn't work but on 2 of my PCs actually works well. For testing purposes saves the ballache of finding a negative rail. Would seem those highly specified RS232 Com ports are nicely 5V-logic compatible. john

Not reliably. Fortunately the RS-232 connector gives you both voltages as part of its signaling (someone please post what they are!). If I were doing this I'd do a web search on "port powered RS-232" or some such, then I'd implement a circuit that looks like this:

+12 === | | .-. | | R2 | | 2k2 '-' | | TX o---------o R1 | 4k7 Q1 | TXdata ___ |/ o-------|___|--- ----o------| Q2 v / | |>

--- | | | .-. | | | | R3 === === | | 4k7 -12 GND '-' | | === GND (created by AACircuit v1.28.6 beta 04/19/05

formatting link

Q1 is a PNP level shifter, R1 limits the emitter current of Q1 to around

1mA (for a 5V VCC). Q2 is an NPN inverter. R3 guarantees that Q2 will shut off smartly.

Dunno how well this will work, I've never actually implemented it -- I've just seen similar arrangements elsewhere & thought they looked clever. There really ought to be a chip out there that does this for you, but I've never had occasion to really dig for one.

Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/

schreef in bericht news: snipped-for-privacy@j52g2000cwj.googlegroups.com...

FAIK the specs want +/-5V at the transmitters and +/-3V at the receivers. I ever got a circuit that worked well using TTL-levels... most of the time. The trouble did me decide never to use TTL to RS232 so I always used 1488/89 (later MAX232) ever since.

petrus bitbyter

Like others said: maybe, maybe not. One simple way of doing it is as follows: driver the led of an optocoupler. Connect the emitter to RTS, collector to RxD, a resistor of 2k2 from collector to DTR. Make sure your software activates RTS and deactivates DTR. this will provide power to the transistor. Now you'll get a fully bipolar signal AND galvanic isolation for free.

Meindert

Yes, it will be, almost certainly. The actual thresholds in receivers are almost always somewhat above zero volts.

This is an okay solution if the connection is short, temporary, and you have control over the computer used (for example, a setup port on a product, which is only use in the manufacturing process, would be a perfect application).

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

That agrees with ANSI/EIA/TIA 232-E-1991. It allows for + and - 3 to 15V.

That depends on the receiver; some do, some don't. If it doesn't you can put a DC bias (negative with respect to ground, in your case) on the RD lead, so the the RD goes slightly neg when the +12 is not present. Uou may need to insert a few kOhms in series from the SD.

Don

Relying on other signals are not as clean a solution, since some cables connect 3 pins (TX, RX and GND) only. Some circuits use the incoming RX off state (-3V to -12V) to store some charges and feed it back to TX via some transistors. It works as long as the local TX duty cycle is less than 50%.

Well, since the OP is designing his circuit, this wouldn't be a problem, would it? And for the cables: even the cheap bulk $0.50 cables have all 9 pins connected.

Oh, and most important: I have actually used this setup many times and it

*always* worked.

Meindert

Tyhe spec requires that a receiver will respond correctly to signals in the +3v to (IIRC) +15v range as positive, and -3v to (IIRC again) -15V as negative. This leaves operation in the +3v-3V range as unspecified.

If you are talking Vce(sat) above ground then IMOextensiveE with RS232 interfaces this will work on 99% of PC clones, ranging from those with 1488/1489 chips to the latest LSI incarnations. As someone lese pointed out, most receivers seem to actually respond as TTL inputs (with clamping).

Whether you have a +5V or +12V on the collector load is pretty much immaterial.

It is certainly NOT a methodology recommended for production. For that I use dedicated MAX chips and generate a true bipolar swing, but for your own quick'n'dirty interface it'll should be fine.

Don't count on it. However, many poorly-designed, non-spec-compliant interfaces will work with those voltages.

Sometimes.

Intermittently.

I did not know that. Please provide a reference to a EUA-232 receiver with such a specification.

formatting link

formatting link

a

near

your

the

for

And as long as the other end isn't trying the same cheap shortcut.

Well Richard, you seem to have a lot to say to people on this subject, and with such authority, even though it's actually on topic :)

The understanding of the spec is correct however the practice is different. Please tell me which common RS-232 receivers *require* a negative threshold (I know they exist, but where are they used). The reality is that the receivers just turn-on at around 1.5V. If you drive them with less than this they are turned-off (output high).

So, for short runs, without serious noise or ground-loop problems the 0 to +5V method will always work, not intermittently as you state, as if the thresholds actually vary constantly. Of course this is not within the EIA-232 spec born from it's archaic requirements, but it is within the chip spec and actual system parameters.

BTW, I design production equipment with MAX232's but that is mainly for customer comfort so I can tell them it is "compliant". I don't get confused with the difference between compliance to a specification vs hardware design. It is my job to understand the hardware without being bamboozled by the hype. Remember Y2K?

*Peter*

Richard Henry wrote:

Two common types-- the thresholds are listed on the data sheets:

formatting link
formatting link

Best regards, Spehro Pefhany

"it\'s the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

Richard you are missing the point of the EIA spec. It mandates that compliant receivers must respond to voltages >+3V as high and to voltages below -3V as low. Any receiver with a threshold between these points will be compliant.

No.

As an example, have a look at the input circuit of the NatSemi:

formatting link

Care to tell us all that it is non-compliant?

It has a positive threshold, with feedback. Care to tell us all that input transition from +5V to Vce(Sat) above ground (or vice versa) won't switch it?

Many well-designed ones will work, too. It's just not guaranteed by the spec to work.

--Mac

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required