Programming 8251 USART Controller
RS 232 INTERFACE
(UNIT-5)
(SUB: Microprocessor and Interfaces)
PREPARED BY:
ER. MOHIT MISHRA
ASSOCIATE PROFESSOR
COMPUTER SCIENCE DEPARTMENT
TOPIC COVERED
• SERIAL AND PARALLEL TRANSMISSION
• SYNCHROUNOUS AND ASYNCHRONOUS
TRANSMISSION
• BASICS OF 8251(USART)
• WORKING OF 8251
• RS 232 INTERFACE
Data Comm: Serial Vs Parallel
• Serial
– Cheaper Data
Transmission
– Slower
• Parallel
– Faster
– Data skew
Parallel Serial
– Limited to small distances
Synchronous ASynchronous
Type of Serial Communication
Transmission Gaps
Sender a Data Data Data Receiver
Asynchronous transmission
CLK
Sender Data Data Data Data Data Receiver
Synchronous transmission
Hardware control Serial I/O
• Programmable chip 8251
• Requirement of HW control serial I/O
– An input/output port are required for interfacing
– Converts data bits in to Parallel to serial & vice
versa
– Data transfer to be synchronized between I/O
– USART (Universal Synchronous Asynchronous
Receiver and Transmitter )
UART/USART
• USART: Universal Synchronous/Asynchronous
Receiver/Transmitter chip.
• The microprocessor sends/receives the data to the
UART in parallel, while with I/O, the UART
transmits/receive data serially.
• 8251 functions are integrated into standard PC
interface chip.
BASICS OF 8251
• Designed for synchronous and asynchronous
data communication.
• Logic control of 8251 is connected with MPU
to determine the function of 8251.
• Coverts data parallel to serial for transmission.
• Coverts data serial to parallel for reception.
WORKING OF 8251
TRANSMITTER SECTION
• Receives parallel data from MPU.
• Converts into serial.
• Transmits serially on TxD Lines.
RECEIVER SECTION
• Receives serial data from RxD.
• Converts into parallel.
• Transfer data to MPU.
8251 Block Diagram
D7-D0 Data Bus Transmit
Buffer Buffer TXD
I
n
t
RESET
e TXRDY
CLK R/W Transmit
C/Db r TXE
RDb
Control Control
n TXC
WRb Logic
CSb a
l
DSRb
DTRb Modem L Receive RXD
CTSb Control i Buffer
RTSb
n
e
Receive RXRDY
Control RXC
SYBDET/BD
8251 Registers
CSb C/Db RDb WRb Meaning
1 X X X Data Bus Tri-state
0 X 1 1 Data Bus Tri-state
0 1 0 1 Status CPU
0 1 1 0 Control Word CPU
0 0 0 1 Data CPU (accept data
from Data Buffer)
0 0 1 0 Data CPU (Out put data
to Data buffer)
RS 232 (RECOMMENDED STANDARD)
• Introduced in 1962
• One of the common serial communication
interface.(now USB)
• Use to connect mouse, monitor and printer.
RS 232 (Recommended Standard)
RS-232 Cable
Transmit 2 Receive
2
Data Data
Terminal Communication
Equipment 3 Equipment
3
Receive Transmit
(DTE) (DCE)
CPU 7 I/O
7
3V +9V +9V +3V
0.2V -9V -9V -0.2V
• RS232: Data transmitted as Voltage to terminal
– 20KBps, 50Mters only
– Improved to RS 422A (9 pine), RS 423A (15 pin-VGA)
• Modem (Data transmitted by Frequency)
RS-232: Mostly used for Monitor
Pin(DB25) Pin(DB9) Signal Function
2 3 TxD: transmitted Data Output CPU to I/O
3 2 RxD :Received Data Input I/O receive from CPU
4 7 RTS :Request to Send Output from I/0
5 8 CTS :Clear to send Input to I/O, HS signal
6 6 DSR: Data set ready CPU send to I/O is ready
7 5 GND Comm. Ref GND
8 1 DCD: Data Carrier Detect I/O to disable reception
20 4 DTR: Data terminal ready Output to indicate I/O is
ready
22 9 RI: RING INDICATOR
DB-25 DB9
RS 232 Vs RS 422
Port name RS-232 RS-422
Transfer type Full duplex Full duplex
15 meters at 9600
Maximum distance 1200 meters at 9600 bps
bps
TxD, RxD, RTS, CTS,
Contacts in use DTR, DSR, DCD, TxA, TxB, RxA, RxB, GND
GND*
Topology Point-to-Point Point-to-Point
Max. Number of
1 1 (10 devices in receive mode)
connected devices