Professional Documents
Culture Documents
• Half duplex:
- Communication is possible in both directions, but only one TX and one RX at a
time. Ex. Police radio
DATA TRANSMISSION TYPES
• Full duplex: -
Communication is possible in both directions, both sides can transmit and
receive in the same time.
USART
• The USART module is a full duplex, serial I/O
communication peripheral.
• It is packed in a 28 pin DIP.
• It contains all shift registers, clock generators and data buffers needed
for serial communication.
• It can work in synchronous mode, or in asynchronous mode.
• The USART uses two I/O pins to transmit and receive serial data. Both
transmission and reception can occur at the same time i.e. ‘full
duplex’ operation.
USAR
T
• To send a byte, the application writes the byte to the transmit buffer.
The USART then sends the data, bit by bit in the
requested format, adding Stop, Start, and parity bits as needed.
• In a similar way, the USART stores received bytes in the
receiver buffer.
Then the USART can generate an interrupt to notify
the processor to find out if data has arrived.
Block diagram of the 8251 USART
Sections of 8251
• Data Bus buffer
• Read/Write Control Logic
• Modem Control
• Transmitter
• Receiver
1. Data Bus Buffer:
• This is bidirectional 8-bit buffer used to interface internal data bus of 8251 to
the microprocessor’s data bus. The direction of data transfer through the data
bus is decided by RD and WR signal. This buffer transfers control word, status
word and data to transfer.
2. Read/Write Control logic
• Itcontrols the operation of the peripherals depending upon
the operation initiated by CPU.
• The control signals RD, WR, C/D, CTS, CLK and RESET are
given to this block to generate control signals for this device.
• Itincludes a control logic, six input control signals & three
buffer registers:
(a) TWO 8-bit data buffer registers : one is for transmitter and other is for
receiver.
(b) One 16-bit control word register, named as two separate registers: mode
word register and command word register.
(c) One 8-bit status register.
Contd.
• Receiver section receives data bit by bit on RxD line in the input
register and at the rate determined by receiver clock.
• The input register converts the serial data into parallel data and
transferred to the receiver buffer register.
• When the data byte is transferred from the input register to receiver
buffer register, the control logic generates a signal RxRDY to signal
processor about the availability of data byte to be read by processor.
Control signals of Receiver section
When RxD goes low, the control logic assumes it is a start bit, waits for
half bit time, and samples the line again. If the line is still low, the input
register accepts the following data, and loads it into buffer register at the
rate determined by the receiver clock.
RxRDY - Receiver Ready Output: Output signal, goes high when the USART
has a character in the buffer register & is ready to transfer it to the MPU.
RxD - Receive Data Input : Bits are received serially on this line
& converted into a parallel byte in the receiver input register.
RxC - Receiver Clock Input : Clock signal that controls the rate at which
bits are received by the USART.
5. Modem Control
The Pin Diagram of 8251 Microcontroller has a set of control inputs and outputs that
can be used to simplify the interface to almost MODEM. The MODEM control unit
allows to interface a MODEM to 8251 and to establish data communication though
MODEM over telephone lines. This unit take care of handshaking signals for MODEM
interface.
DSR (Data Set Ready) : Checks if the Data Set is ready when communicating with a
modem.
DTR (Data Terminal Ready) : Indicates that the device is ready to accept data when
the 8251 is communicating with a modem
RTS (Request to Send ) : Low signal indicates the modem that the receiver is ready to
receive a data byte from the modem.
CTS (Clear to Send) : A low on this input enables the 8251A to transmit serial data if
the TxE bit in the command byte is set to a “one”.
Pin diagram of 8251
D0 – D7: This is an 8-bit bidirectional data bus used to read or write status,
command word or data from or to the 8251A
RD: This active-low input to 8251A is used to inform it that the CPU is reading
either data or status information from its internal registers
WR: . This active-low input to 8251A is used to inform it that the CPU is writing
data or control word to 8251A.
C / D: (Control Word/Data): This input pin, together with RD and WR inputs,
informs the 8251A that the word on the data bus is either a data or control
word/status information. If this pin is 1, control / status is on the bus, otherwise
data is on the bus.
CLK: This input is used to generate internal device timings and is normally
connected to clock generator output.
RESET: A high on this input forces the 8251A into an idle state.
CS : (Chip Select)When signal goes low, the 8251A is selected by the MPU for
communication.
Pin diagram of 8251
• TxD-(Transmit Data):-This is an output line for transmitting serial bits
out on the falling edge of TxC, which transmitter clock.
• TxC-(Transmitter clock):-This input signal controls the rate at which the
bits are transmitted by the USART. In synchronous mode, the baud rate
will be the same as the frequency of TxC. In asynchronous mode, it is
possible to select the baud rate factor by mode instruction.
• TxRDY-transmitter Ready: This is the output signal. When it is high, it
indicates the buffer register is empty and USART is ready to accept a
byte. It can be used either to interrupt the MPU or to indicate the
status. This signal is reset when a data byte is loaded into the buffer.
• TxE-Transmitter Empty: This is an output signal. Logic 1 on this
indicates the output register is empty after transmitting all the
characters. This signal is reset when a byte is transferred from the
buffer to the output register.
Pin diagram of 8251
• RxD-Receive Data: Bits are received serially on this line and
converted into a parallel byte in the receiver input register.
• RxC-Receiver clock: This is a clock signal that controls the
rate at which bits are received by the USART. In the
asynchronous mode, the clock can be set to 1,16 or 64
times the baud.
• RxRDY-Receiver Ready: This is an output signal. It goes high
when the USART has a character in the buffer register and is
ready to transfer into the MPU. This line can be used either
to indicate the status or to interrupt the MPU. When MPU
reads a data character, RxRDY will be reset by the leading
edge of RD signal.
Pin Diagram of 8251
• SYNDET/BD (Input or output terminal)
• This pin is used in synchronous mode as SYNDET for detection of
synchronous characters and may be used as either input or output.
• When used as an input (external sync detect mode) a positive signal on
syndet/bd will cause the 8251A to start receiving data characters on the
rising edge of the next RXC.
• When used as output (internal sync detect mode) then syndet pin go high
to indicate that the 8251 has located the sync character.
• In asynchronous mode this pin goes high if receiver line stays low for more
than 2 character times. It then indicates a break in the data stream, so used
as BD.
8251 mode register
7 6 5 4 3 2 1 0 Mode register
Number of
Baud Rate
Parity enable
Stop bits
0: disable 00: Syn. Mode
00: invalid 1: enable 01: x1 clock
01: 1 bit 10: x16 clock
10: 1.5 bits Character length 11: x64 clock
11: 2 bits
00: 5 bits
01: 6 bits
Parity 10: 7 bits
0: odd 11: 8 bits
1: even
Serial Port
Stop bit 1: One stop bit is transmitted to indicate the end of a byte.
Stop bit 1.5: The stop bit is transferred for 150% of the normal time used to
transfer one bit.
Stop bit 2: Two stop bits are transmitted to indicate the end of a byte.
8251 command register
EH IR RTS ER SBRK RxE DTR TxE