This is a pretty old standard but still widely used in embedded systems. Using the RS232 interface standard, the data is sent bit by bit. Usually, first comes LSB. The receiver receives data by knowing the position of each data piece and delay. To ensure the quality of data transmission, we need to control the start of transmission. The acknowledgment procedure does this. Let’s take the asymmetrical type of interface RS232-C. The transmitter sends RTC (request to send) signal to the receiver. On the other hand, the receiver detects this signal, finishes the previous operation, and then sends to receiver CTS (clear to send) signal, which means that receiver is ready to accept data. Without CTS transmitter cannot start data transmission.
Note: In the RS232 interface, logical “1” corresponds to voltages from -3V to -12V, and logical “0” corresponds to voltages from +3V to +12V. The logical level in the interval -3V to +3V is undefined.
Lets take some example. If we want to send byte 1100111011
This byte is sent asynchronously. This means that receiver doesn’t know when the transmitter will start sending data. But anyway, there are some means needed to inform about the start of transmission, for this is START bit used at the beginning of the transmitted data. The falling edge of the START bit (from logical “1” to “0”) informs the receiver about the start of transmission. After the receiver detected the start signal, it starts reading data after a time equal to half period of the start signal. This ensures that the data will be read correctly. All those operations are performed by hardware (DIG-UART – universal asynchronous receiver transmitter).
After the last MSB bit is received, it follows the Parity bit, which allows the user to control received information by parity or skip the control. If control is selected, then bit will be “1” if there will be an even number of ones and “0” otherwise. After the byte is received, UART stores it in the data register and informs that data is ready to take. The microcontroller has to read this byte before the next byte is received. Otherwise, the data will be lost.
Usually, hardware checking of received data is disabled because it is substituted by CRC (cyclic redundancy check) calculation and transmission. The receiver first receives the data array with a CRC code, then the receiver recalculates CRC and compares it to the received one. If CRC codes don’t match, then the transmission is repeated.
RS232 interface has its popularity because it is simple to use and cheap. But it also has disadvantages like crosstalk. It is sensitive to different grounds of receiver and transmitter. This reduces the speed and distance of communication.
In RS232 standard, there are two connection types used: DB9 and DB25. DB25 connector is obsolete.
The pins:
CTS Clear To Send [DCE –> DTE]
DCD Data Carrier Detected (Tone from a modem) [DCE –> DTE]
DCE Data Communications Equipment eg. modem
DSR Data Set Ready [DCE –> DTE]
DSRS Data Signal Rate Selector [DCE –> DTE] (Not commonly used)
DTE Data Terminal Equipment eg. computer, printer
DTR Data Terminal Ready [DTE –> DCE]
FG Frame Ground (screen or chassis)
NC No Connection
RCk Receiver (external) Clock input
RI Ring Indicator (ringing tone detected)
RTS Ready To Send [DTE –> DCE]
RxD Received Data [DCE –> DTE]
SG Signal Ground
SCTS Secondary Clear To Send [DCE –> DTE]
SDCD Secondary Data Carrier Detected (Tone from a modem)[DCE –> DTE]
SRTS Secondary Ready To Send [DTE –> DCE]
SRxD Secondary Received Data [DCE –> DTE]
STxD Secondary Transmitted Data [DTE –> DTE]
TxD Transmitted Data [DTE –> DTE]