1
\$\begingroup\$

I'm writing a program in C to talk to a modem via an RS-232 serial port. Unix supports 6 pinouts in the serial line, including TXD (Transmitted Data), RXD (Received Data), DCD (Data Carrier Detect), DTR (Data Terminal Ready), CTS (Clear To Send), and RTS (Request To Send).

Now according to the below documentation, RS-232 actually comes in 3 different flavors (A, B, and C) with each one defining a different voltage range for the on and off levels. The most commonly used variety is RS-232C, which defines a mark (on) bit as a voltage between -3 V and -12 V and a space (off) bit as a voltage between +3 V and +12 V.

http://www.cmrr.umn.edu/~strupp/serial.html

Why is an on bit defined with a negative voltage and an off bit defined with a positive voltage? Shouldn't it be reversed?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Because it is 50 years old junk. There is no modern rationale for it. \$\endgroup\$
    – Lundin
    Mar 25, 2014 at 10:10

3 Answers 3

2
\$\begingroup\$

AFAIK the A, B and C standards are updates, they don't specify different voltage levels.

Why those strange, inverted levels? The RS232 electrical characteristics are VERY old, and were originally chosen to drive electromechanical terminals (teletypes). Those levels were appropriate for that technology.

After that, why change? For the same reason, we still have a keyboard layout that was designed to prevent fast typing...

\$\endgroup\$
0
\$\begingroup\$

In RS232 a valid "spacing" voltage (data bit 0) is +3 to +15 when connected and tolerant to +25 when open-circuit. The "marking" (data bit 1) voltage levels are -3 to -15 and -25. The drivers and receivers are tolerant of a short to another signal. The signal will not go through then, but the drivers & receivers should recover once the short is rectified. Suggested reference

Since -3 to +3 is signal's non-man land, many receivers use a biased mid-point away from 0.0V to 1) prevent a grounded input from chattering 2) or bias to a mid-point like +2.5V to allow 0 and 5 voltage signals.

RS232 also defines a maximum slew-rate (dV/dt) that is generally ignored else high baud values would not be allowed.

Agree with @Wouter van Ooijen. It worked then and many technologies are evolutionary - not revolutionary.


Some additional musings.
Some RS232 terms go way back to early telegraph.

The terms for signal condition of "Space" (Data bit 0) and "Mark" (data bit 1) denote when a paper tape was "marked" or not. Soon this was changed to audio signals instead.

RS232 "break" condition (All data bits 0 and stop bit 0) corresponds to a telegraph operator "breaking" the circuit. Back-in-the-day, all the operators, shared a signal wire. When not sending, they left the keypad in a closed position - creating an idle voltage. Any one operator signaled "break" to announce a following message. By then tapping on the keypad, the circuit momentarily created the dits and dahs of Morse code.

Moving forward with teletype, I suspect a dual +/- voltage was needed to drive the mechanisms closed and open. But the concept of a "break" to announce an incoming message persisted. (This does not address why it is +V means 0 and -V means 1 versus the other way around.)

\$\endgroup\$
0
\$\begingroup\$

"The most commonly used variety is RS-232C, which defines a mark (on) bit as a voltage between -3V and -12V and a space (off) bit as a voltage between +3V and +12V"

It gets even worse than that !

The standard is this way for TxD / RxD:

-12V to -3V  = Logical 1 = Mark.
+3V  to +12V = Logical 0 = Space.

But for all other pins (DTR, DSR, RTS, CTS, DCD, RI) it is just the opposite way:

-12V to -3V  = Logical 0.
+3V  to +12V = Logical 1.

This seems to be a less known fact about the RS-232C standard.

Another thing to be aware of:

The popular MAX232 IC:

https://www.tme.eu/en/katalog/integrated-circuits_100283/?search=MAX232

translates RS-232 side negative voltage to TTL level "1" (near +5V)
and it
translates RS-232 side positive voltage to TTL level "0" (near 0V).

Something to be aware of when designing your own circuits and/or software that interacts with those circuits.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.