Microprocessor Unit 5
Microprocessor Unit 5
Unit 5 Syllabus
Peripheral Devices: 8237 DMA Controller, 8255 programmable peripheral
interface, 8253/8254 programmable timer/counter, 8259 programmable
interrupt controller, 8251 USART and RS232C.
8237 DMA Controller
What is DMA (Direct Memory Access)?
Direct Memory Access (DMA) transfers the block of data between
the memory and peripheral devices of the system, without the
participation of the processor. The unit that controls the activity of
accessing memory directly is called a DMA controller.
The processor gives the control of the system bus to the DMA
controller for a few clock cycles. So, the DMA controller can accomplish
the task of data transfer via the system bus.
Base Address Registers and Base Word Count Registers: Each channel has a
pair of Base Address and Base Word Count registers. These 16-bit registers
store the original value of their associated current registers. During Auto-
initialize these values are used to restore the current registers to their original
values.
Current Address Registers: This register holds the value of the address used
during DMA transfers. The address is automatically incremented or
decremented after each transfer and the intermediate values of the address are
stored in the Current Address register during the transfer.
Current Word Count Registers: This register determines the number of transfers
to be performed. The actual number of transfers will be one more than the
number programmed in the Current Word Count register (i.e., programming a
count of 100 will result in 101 transfers). The word count is decremented after
each transfer.
Status Register: It contains information about the status of the devices at this
point. This information includes which channels have reached a terminal count
and which channels have pending DMA requests.
Command Register: This 8-bit register controls the operation of the 8237A. It is
programmed by the microprocessor in the Program Condition and is cleared by
Reset or a Master Clear instruction.
Temporary Register: The Temporary register is used to hold data during
memory-to-memory transfers. Following the completion of the transfers, the
last word moved can be read by the microprocessor in the Program Condition.
The Temporary register always contains the last byte transferred in the previous
memory-to-memory operation, unless cleared by a Reset.
Mode Registers: Each channel has a 6-bit Mode register associated with it.
When the register is being written to by the microprocessor in the Program
Condition, bits 0 and 1 determine which channel Mode register is to be written.
Mask Register: Each channel has associated with it a mask bit which can be set
to disable the incoming DREQ (DMA Request). Each mask bit is set when its
associated channel produces an EOP (End of Process) if the channel is not
programmed for auto-initialize.
Request Register: The 8237A can respond to requests for DMA service which
are initiated by software as well as by a DREQ. Each channel has a request bit
associated with it in the 4-bit Request register.
Pin Diagram of 8237:
Modes of Operation in 8237 A:
The 8237A is designed to operate in two major cycles. These are called Idle and
Active cycles.
Idle cycle:
The idle cycle is when no channel is requesting service, the 8237A will enter
the Idle cycle and perform ‘‘SI (Inactive state)’’ states.
Active Cycle:
When the 8237A is in the idle cycle and a non-masked channel requests a DMA
service, the device will output an HRQ (Hold Request) to the microprocessor
and enter the Active cycle. It is in this cycle that the DMA service will take
place, in one of four modes:
Single Transfer Mode
Block Transfer Mode
Demand Transfer mode
Cascade Mode
Functional Description:
This support chip is a general purpose I/O component to interface peripheral
equipment to the microcomputer system bus. It is programmed by the system
software so that normally no external logic is necessary to interface peripheral
devices or structures.
To communicate with peripherals through the 8255A, three steps are necessary.
Determine the addresses of ports A, B, and C and of the control register
according to the Chip Select logic and address lines A0 and A1.
Write a control word in the control register.
Write I/O instructions to communicate with peripherals through ports A,
B, and C.
Modes of Operation
All the functions of 8255A, classified according to two modes: the Bit Set/Reset
(BSR) mode and the I/O mode. The I/O mode is further divided into three
modes: Mode 0, Mode 1, and Mode 2.
The BSR Mode is used to set or reset the bits in port C.
In Mode 0 all ports functions as simple I/O ports.
Mode 1 is a Handshake mode where by ports A&B uses bits from port C
as Handshake signals. In the handshake mode, two types of I/O data
transfer can be implemented: status checks and interrupt.
In Mode 2, port A can be set up for bi-directional data transfer using
handshake signals from port C.
In mode 0, all ports function as simple I/O ports for each of the three ports. In
the first mode, mode-0, each group may be programmed in either input mode or
output mode (PORT A, PORT B, PORT C lower, PORT C upper). In mode 0,
the ports do not have handshaking and interrupt capability.
In mode-1, the second mode, only port A and B can be programmed either as
input or output port. In this mode, handshake signals are exchanged between
processor and peripherals prior to the data transfer. PORT C lines are used for
handshaking and interrupt control signals.
In mode 2, port A is a bidirectional port used as a bidirectional bus and five
lines (PORT C upper 4 lines and borrowing one line from PORT C lower) for
handshaking and control signals. Only port A can be programmed to work in
mode 2. Interrupt generation and enable/disable functions are also available.
Control Word
A control register is an 8-bit register stores the Control word which specifies an
I/O function for each port. This register can be accessed to write a control word
when A0 and A1 are at logic 1. The register is not accessible for a Read
operation.
Bit D7 of the control register specifies either the I/O function or the Bit
Set/Reset function.
If bit D7=1, bits D6-D0 determine I/O functions in various modes. If bit D7=0,
port C operates in the Bit Set/Reset (BSR) mode.
8254
PROGRAMMABLE TIMER/COUNTER
8253 8254
Reads and writes of the same counter Reads and writes of the same counter
cannot be interleaved. can be interleaved.
8259
Programmable Interrupt Controller
The 8259A accepts two types of command words generated by the CPU:
1. Initialization Command Words (ICWs): Before normal operation can
begin, each 8259A in the system must be brought to a starting point by a
sequence of 2 to 4 bytes timed by WR pulses.
2. Operation Command Words (OCWs): These are the command words
which command the 8259A to operate in various interrupt modes. These
modes are:
a. Fully nested mode
b. Rotating priority mode
c. Special mask mode
d. Polled mode
The OCWs can be written into the 8259A anytime after initialization.
Modes of operation:
The various modes of operation of the Block Diagram of 8259 Programmable
Interrupt Controller are:
Fully Nested Mode,
Special Fully Nested Mode (SFNM)
Rotating Priority Mode,
Special Masked Mode, and
Polled Mode.
Polled Mode:
The microprocessor checks the status of interrupt requests by issuing poll
command. The microprocessor reads contents of 8259A after issuing poll
command.
8251
Universal Synchronous/ Asynchronous Receiver/
Transmitter (USART)
USART:
It is designed for data communications with Intel’s microprocessors.
It is used as a peripheral device and is programmed by the CPU to operate
using virtually any serial data transmission technique.
The USART accepts data characters from the CPU in parallel format and
then converts them into a continuous serial data stream for transmission.
Simultaneously, it can receive serial data streams and convert them into
parallel data characters for the CPU.
It is made with HMOS technology.
Transmitter
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 parallel data into serial bits.
If buffer register is empty, then TxRDY is goes to high.
If output register is empty then TxEMPTY goes to high.
The clock signal, TxC (low) controls the rate at which the bits are
transmitted by the USART.
Receiver
• The CPU reads the parallel data from the buffer register.
• When the input register loads a parallel data to buffer register, the RxRDY line
goes high.
• The clock signal RxC (low) controls the rate at which bits are received by the
USART.
• During asynchronous mode, the signal SYNDET/BRKDET will indicate the
break in the data transmission.
• During synchronous mode, the signal SYNDET/BRKDET will indicate the
reception of synchronous character.
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 825 1A can be either memory mapped or I/O mapped in the system.
• The data lines D0 - D7 are connected to D0 - D7 of the processor to achieve
parallel data transfer.
• The RESET and clock signals are supplied by the processor. Here the
processor clock is directly connected to 8251A. This clock controls the parallel
data transfer between the processor and 8251A.
RS-232C is the interface that your computer uses to talk to and exchange data
with your modem and other serial devices. Somewhere in your PC, typically on
a Universal Asynchronous Receiver/Transmitter (UART) chip on your
motherboard, the data from your computer is transmitted to an internal or
external modem (or other serial device) from its Data Terminal Equipment
(DTE) interface. Since data in your computer flows along parallel circuits and
serial devices can handle only one bit at a time, the UART chip converts the
groups of bits in parallel to a serial stream of bits. As your PC's DTE agent, it
also communicates with the modem or other serial device, which, in accordance
with the RS-232C standard, has a complementary interface called the Data
Communications Equipment (DCE) interface.
In 1987, the EIA released a new version of the standard and changed the name
to EIA-232-D. And in 1991, the EIA teamed up with Telecommunications
Industry association (TIA) and issued a new version of the standard called
EIA/TIA-232-E. Many people, however, still refer to the standard as RS-232C,
or just RS-232.
Almost all modems conform to the EIA-232 standard and most personal
computers have an EIA-232 port for connecting a modem or other device. In
addition to modems, many display screens, mice, and serial printers are
designed to connect to an EIA-232 port. In EIA-232 parlance, the device that
connects to the interface is called a Data Communications Equipment (DCE)
and the device to which it connects (e.g., the computer) is called a Data
Terminal Equipment (DTE).