Data Transfer Schemes 8255A 8251
Data Transfer Schemes 8255A 8251
In parallel data transfer, a group of bits (for eg., 8 bits) are transmitted
from one device to another at any one time
The data transfer schemes have been broadly classified into the following
two categories :
1. Programmed data transfer.
2. Direct Memory Access (DMA) data transfer.
The programmed data transfer scheme can be further classified into the following
three types:
1. Synchronous data transfer scheme.
2. Asynchronous data transfer scheme.
3. Interrupt driven data transfer scheme.
The DMA data transfer is used for a large block of data transfer
between the IO(input-output) device and memory. Typical examples
of devices using DMA are CRT controller, floppy disk, hard disk, high
speed line printer, etc.
The DMA data transfer schemes are :
a) Cycle stealing DMA or Single transfer mode DMA.
b) Block or Burst mode DMA.
c) Demand transfer mode DMA.
Figure given below shows the various types of data transfer scheme. All
the data transfer schemes discussed above require both software and
hardware for their implementation
In this scheme, the processor sends a request to the device for read/
write operation. Then the processor keeps on polling the status of the
device. Once the device is ready, the processor executes a data
transfer instruction to complete the process.
Then the processor call an Interrupt Service Subroutine (ISS) to service the
interrupting device.
At the end of ISS, the processor status is retrieved from stack and the processor
starts executing its main program. The sequence of operations for an interrupt
driven data transfer scheme is shown in above Fig.(a) and (b).
Programmable Peripheral Inter face - INTEL 8255:
The 8255 has three ports: Port-A, Port-B and Port-C. The ports A and
B are 8-bit parallel ports.
Port-A can be programmed to work in any one of the three operating
modes as input or output port. The three operating modes are :
IO Modes of 8255
Mode-0 : In this mode all the three ports(A,B and C) can be programmed either
as input or output port.
In mode-0, the outputs are latched and the inputs are not latched. The
ports do not have handshake or interrupt capability.
The ports in mode-0 can be used to interface DIP switches, Hexa-keypad,
LEDs and 7-segment LEDs to the processor.
Mode-1 : In this mode, only ports A and B can be programmed either as input or
output port.
In mode-1, handshake signals are exchanged between the processor and
peripherals prior to data transfer.
The port-C pins are used for handshake signals. Input and output data are
latched. Interrupt driven data transfer scheme is possible.
Mode-2 : In this mode the port will be a bidirectional port (i.e., the processor can
perform both read and write operations with an IO device connected to a
port in mode-2).
Only port-A can be programmed to work in mode-2. Five pins of port-C are
used for handshake signals.
This mode is used primarily in applications such as data transfer between
two computers or floppy disk controller interface.
Pins, Signals and Internal Block Diagram of 8255
Pins, Signals and Internal Block Diagram of 8255
The pin description of 8255 is shown in fig(a) given below.
It has 40 pins and requires a single +5-V supply.
The internal block diagram of 8255 is shown in Fig.(b)
Fig.(a) The pin description of 8255
The ports are grouped as Group A and Group B. The group A has
port-A, port-C upper and its control circuit.
The group B comprises port-B, port-C lower and its control circuit.
The read/ write control logic requires six control signals. These
signals are given below:
𝑹𝑫 (Read): This control signal enables the read operation. When this signal
is low, the microprocessor reads data from a selected IO port of the 8255A.
𝑾𝑹 (Write): This control signal enables the write operation. When this signal
goes low, the microprocessor writes into a selected IO port or the control
register.
RESET: This is an active high signal. It clears the control register and set all
ports in the input mode.
𝑪𝑺 , A0 and A1: These are device select signals. The address lines A0 and A1
of 8255 can be connected to any two address lines of the processor to provide
internal addresses.
A0 and A1 selects any one of the 4 internal devices as shown in Table-
The 8255 will remain in high impedance state if the signal input to 𝑪𝑺 is
high and the device can be brought to normal logic by making the signal
input to CS as logic low.
Bit D7 of the control register specifies either I/O function or the Bit
Set/Reset function.
If bit D7=1, bits D6-D0 determine I/O functions in different modes of
8255.
Figure (a)
Fig.(b) 8255 Ports and their modes
Problem Statement:
1. Identify the port addresses in fig. given below
2. Identify the Mode-0 control word to configure port A and port CU as output
port and port B and port CL as input port
3. Write a program to read the DIP switches and display the reading from port
B at port A and from port CL at port CU
Solution: Port Addresses: This is a memory mapped I/O; when the address
line A15 is high, the chip select line is enabled. Assuming all don’t care lines
are at logic 0, the port addresses are as follows
Port A = 8000H(A1=0, A0=0)
Port B = 8001H(A1=0, A0=1)
Port C = 8002H(A1=1, A0=0)
Control Register = 8003H (A1=1, A0=1)
Problem: Write a BSR control word subroutine to set bits PC7 and PC3 and
reset them after 10ms. Assume that a delay subroutine is available.
Solution:
Port Address:
Control register address=83H
Mode-1 :.Input or Output with Handshake
In mode-1, handshake signals are exchanged between the
processor and peripherals prior to data transfer.
The port-C pins are used for handshake signals. Input and
output data are latched. Interrupt driven data transfer scheme is
possible
Input and output data are latched
The signals 𝑅𝐷, 𝑊𝑅, C/𝐷 and 𝐶𝑆 are used for read/write operations
with these registers. When C/D is high, the control register is selected
for writing control word or reading status word. When C/D is low, the
data buffer is selected for read/write operation.
A high on the reset input forces 8251A into the idle mode. The clock
input is necessary for 8251A for communication with CPU and this
clock does not control either the serial transmission or the reception
rate
Transmitter Section
The transmitter section accepts parallel data from CPU and converts
them into serial data. The transmitter section is double buffered, i.e.,
it has a buffer register to hold an 8-bit parallel data and another
register called output register to convert the previous data into a
stream of serial bits.
The processor loads a data into buffer register. When output register
is empty, the data is transferred from buffer to output register. Now
the processor can again load another data in buffer register. If buffer
register is empty, then TxRDY is asserted high and if output register
is empty then TxEMPTY is asserted high. These signals can also be
used as interrupt or status for data transmission.
The clock signal, 𝑇𝑥𝐶 controls the rate at which the bits are
transmitted by the USART. The clock frequency can be 1.16 or 64
times the baud rate.
Receiver Section
The receiver section accepts serial data and converts them into
parallel data. The receiver section is double buffered, i.e., it has
an input register to receive the serial data and convert it to
parallel, and a buffer register to hold the previous converted
data.
Normally, RxD line is high, when the RxD line goes low, the
control logic assumes it as a START bit, waits for half a bit time
and samples the line again.
If the line is still low, then the input register accepts the following
bits, forms a character and loads it into the buffer register. The
CPU reads the parallel data from the buffer register.
The clock signal RxC controls the rate at which bits are received
by the USART. In the asynchronous mode, the clock frequency
can be set to 1.16 or 64 times the baud rate.
MODEM Control
The MODEM control unit allows to interface a MODEM to 8251A and
to establish data communication through MODEM over telephone
lines. This unit takes care of handshake signals for MODEM interface
The format of control and status words are shown in Fig. 7.31.
The mode word informs 8251 about the baud rate, character
length, parity and stop bits. The command word can be sent to
enable the data transmission and/or reception. The information
regarding the readiness of transmitter/receiver and the
transmission errors can be obtained from the status word.
The TTL logic levels of the serial data lines (RxD and TxD) and the
control signals necessary for serial transmission and reception are
converted to RS232 logic levels using MAX232 and then terminated
on a standard 9 -pin D-type connector.