Académique Documents
Professionnel Documents
Culture Documents
Cs609@vu.edu.pk
Lecture # 14
RS – 232C Standard
• Standard for physical dimensions of the
connectors.
RS – 232C Cable
PC (DCE)
Modem
(DTE) Connected via
serial port
13
25
12
24
11
23
10
22 RI
9
21
CD 8
20 DTR
GND 7 19
DSR 6 18
CTS 5
17
RTS 4
16
RD 3
15
TX D 2
14
1
25 pin connector on PC
RI
CD
DSR
PC RTS MODEM
CTS
RxD TxD
Data is received through the RxD line. Data is send through the TxD line. DTR (data
terminal ready) indicates that the data terminal is live and kicking. DSR(data set ready)
indicates that the data set is live. Whenever the sender can send data it sends the signal
RTS( Request to send) if as a result the receiver is free and can receive data it send the
sender an acknowledge through CTS( clear to send) indicating that its clear to send now.
DB9 Connector
1
CD
6
2 DSR
Rx D 7
3 RTS
TxD 8
4 CTS
DT R 9
5 RI
GND
UART internals
UART Internals R xD
Receiver Buffer Register Receiver Shift Register
Transmit Shift T xD
Transmitter Holding Register
Register
This slide shows the various internal registers within a UART device. The programmer
only needs to program these registers efficiently in order to perform asynchronous
communication.
Virtual University of Pakistan 115
System Programming Course Code: CS609
Cs609@vu.edu.pk
Register summary
Base +
Transmitter Holding Register THR 0
Receiver Dat a RBR 0
Band Rate Divisor (Low Byte) DLL 0
Band Rate Divisor (High Byte) DLM 1
Interrupt Enable IER 1
FIFO Control Register FCR 2
Interrupt ID IIR 2
Line Cont rol LCR 3
Mode Control MCR 4
Line Status LSR 5
Modem Status MSR 6
Scratch Pad SP 7
The above table lists the registers within the UART ans also shows their abbreviation.
Also it shows there offsets with respect to the base register.
Text Dump
-d 40:0
The above dump of the BIOS data area for a certain computer shows that the address of
COM1 is 03F8 , the address of COM2 is 02F8 and the address of COM3 is 03E8. These
addresses may not be same for all the computers and may vary computer to computer.
The baud rate is set in accordance with the divisor value loaded within the UART internal
registers base +0 and base +1.
Virtual University of Pakistan 117
System Programming Course Code: CS609
Cs609@vu.edu.pk
The line control register contains important information about the behaviour of the line
through which the data will be transferred. In it various bits signify the word size, length
of stop bits, parity check, parity type and also the a control bit to load the divisor value.
The bit 7 if set indicates that the base +0 and base + 1 will act as the divisor register
otherwise if cleared will indicate that base + 0 is the data register.
Data Ready =1
Line status register illustrates the status of the line. It indicates if the data can be sent or
received. If bit 5 and 6 both are set then 2 consecutive bytes can be sent for output. Also
this register indicates any error that might occur during communication.
Trigger Interrupt
On Data Ready =1
Trigger Interrupt
As soon as THR is empty =1
Trigger Interrupt
On change in Modem Status =1 Trigger Interrupt
On line status change =1
If interrupt driven output is to be performed then this register is used to enable interrupt
for the UART. It can also used to select the events for which to generate interrupt as
described in the slide.
Interrupt ID Register
Interrupt ID Register
2 1 0
Trigger Triggered
Modem/Line
00 =Change in Modem Status
01 = THR is Empty
10 = Data is Ready
11 =Error in Data
Once an interrupt occurs it may be required to identify the case of the interrupt. This
register is used to identify the cause of the interrupt.