RS-232 Tutorial – 3 Easy Steps to Understand and Control Your RS232 Devices

Step 1: Understand RS-232 Connections & Signals

-RS-232C, EIA RS-232, or simply RS-232, refers to the same standard defined by the Electronic Industries Association in 1969 for serial communication.
-DTE and DCE
-DTE stands for Data Terminal Equipment. A computer is a DTE. DCE stands for Data Communication Equipment. A modem is a DCE.
-DTE normally comes with a Male Connector, hex to decimal while DCE comes with a Female Connector. However, that is not always true. Use the simple way below to confirm:

Measure Pin 3 and Pin 5 of a DB-9 Connector with a Volt Meter, if you get a voltage of -3V to -15V, then it is a DTE device. If the voltage is on Pin 2, then it is a DCE device.
Note: The result for a DB-25 Connector is reversed (Please refer to DB-9 to DB-25 conversion table below).

RS-232 Pinouts (DB-9)

A male DB-9 connector viewed from the front. Reverse or back view of male connector for Female Connector.

DTE Pin Assignment (DB-9) DCE Pin Assignment (DB-9)

1 DCD Data Carrier Detect 1 DCD Data Carrier Detect
2 RxD Receive Data 2 TxD Transmit Data
3 TxD Transmit Data 3 RxD Receive Data
4 DTR Data Terminal Ready 4 DSR Data Set Ready
5 GND Ground (Signal) 5 GND Ground extreamfirearms (Signal)
6 DSR Data Set Ready 6 DTR Data Terminal Ready
7 RTS Request to Send 7 CTS Clear to Send
8 CTS Clear to Send 8 RTS Request to Send
9 RI Ring Indicator 9 RI Ring Indicator

DB-9 to DB-25 Conversion
DB-9 DB-25 Function
1 8 DCD Data Carrier Detect
2 3 RxD Receive Data
3 2 TxD Transmit Data
4 20 DTR Data Terminal Ready
5 7 GND Ground (Signal)
6 6 DSR Data Set Ready
7 4 RTS Request to Send
8 5 CTS Clear to Send
9 22 RI Ring Indicator

RS-232 Connections

A straight-through cable is used to connect a DTE (e.g. computer) to a DCE (e.g. modem), all signals in one side connected to the corresponding signals in the other side in a one-to-one basis.

A crossover (null-modem) cable is used to connect two DTE directly, without a modem in between. They cross transmit and receive data signals between the two sides and there are many variations on how the other control signals are wired, below is one of them:

Straight-through (DB-9) Crossover (Null-Modem) (DB-9)
(DTE) (DCE) (DTE) (DTE)
1 DCD ——- DCD 1 1 DCD DCD 1
2 RxD ——- TxD 2 2 RxD ——- TxD 3
3 TxD ——- RxD 3 3 TxD ——- RxD 2
4 DTR ——- DSR 4 4 DTR ——- DSR 6
5 GND ——- GND 5 5 GND ——- GND 5
6 DSR ——- DTR 6 6 DSR ——- DTR 4
7 RTS ——- CTS 7 7 RTS ——- CTS 8
8 CTS ——- RTS 8 8 CTS ——- RTS 7
9 RI ——- RI 9 9 RI RI 9

Null-Modem (Model: CVT-Null-1)

RS-232 Signals

RS-232 Logic Waveform (8N1)

The graphic above illustrates a typical RS-232 logic waveform (Data format: 1 Start bit, 8 Data bits, No Parity, 1 Stop bit). The data transmission starts with a Start bit, followed by the data bits (LSB sent first and MSB sent last), and ends with a “Stop” bit.

The voltage of Logic “1” (Mark) is between -3VDC to -15VDC, while the Logic “0” (Space) is between +3VDC to +15VDC.

RS-232 connects the Ground of 2 different devices together, which is the so-called “Unbalanced” connection. An unbalanced connection is more susceptible to noise, and has a distance limitation of 50 ft (which is around 15 meters).

Step 2: Learn about the Protocol

-A protocol is one or a few sets of hardware and software rules agreed to by all communication parties for exchanging data correctly and efficiently.
-Synchronous and Asynchronous Communications
-Synchronous Communication requires the sender and receiver to share the same clock. The sender provides a timing signal to the receiver so that the receiver knows when to “read” the data. Synchronous Communication generally has higher data rates and greater error-checking capability. A printer is a form of Synchronous Communication.

Asynchronous Communication has no timing signal or clock. Instead, infomaatic it inserts Start/Stop bits into each byte of data to “synchronize” the communication. As it uses less wires for communication (no clock signals), Asynchronous Communication is simpler and more cost-effective. RS-232/RS-485/RS-422/TTL are the forms of Asynchronous Communications.

Drilling Down: Bits and Bytes

Internal computer communications consists of digital electronics, represented by only two conditions: ON or OFF. We represent these with two numbers: 0 and 1, which in the binary system is termed a Bit.

A Byte consists of 8 bits, which represents decimal number 0 to 255, or Hexadecimal number 0 to FF. As described above, a byte is the basic unit of Asynchronous communications.

 

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *