Unit3 Part2
Unit3 Part2
PERIPHERAL INTERFACING
*******************************************************************************************
Study on need, Architecture, configuration and interfacing, with ICs: 8255, 8259, 8254, 8237, 8251, 8279, -
A/D and D/A converters &Interfacing with 8085& 8051.
**************************************************************************************************
1. Introduction:
Parallel Serial
1
Comparison of Asynchronous/ Synchronous Data Transfer techniques
Asynchronous Synchronous
************************************************************************************************************
Describe the internal block diagram of 8255 / PPI .(December 2010) (April 2018)(December 2017)
Explain the functioning of 8255 programmable peripheral interface and its modes. [April/May 2017,
May/June 2016, April/May 2015, Nov/Dec2015,April/May 2011,May/June 2014,May/June
2013,Nov/Dec 2013,May/June 2009]
*********************************************************************************
. 2.Parallel communication interface (8255)(Programmable peripheral interface)
Definition:
The 8255 is a general purpose programmable I/O device used for parallel data transfer. It can be
programmed to transfer data under various conditions, from simple I/O to Interrupt I/O. It is flexible,
versatile and economical when multiple I/O ports are required.
Functional Block Diagram
The 8255 consists of four sections namely,
• Data bus buffer
• Read/write control logic
• Group A control
• Group B control
2
Figure. Block diagram of 8255 Programmable Peripheral interface.
3
Group A and Group B control:
• Group A and B get the Control Signal from CPU and send the command to the individual
control blocks.
• Group A send the control signal to port A and Port C (Upper) PC7-PC4.
• Group B send the control signal to port B and Port C (Lower) PC3-PC0.
PORT A:
• This is a 8-bit buffered I/O latch.
• It can be programmed by mode 0 , mode 1, mode 2 .
PORT B:
• This is a 8-bit buffer I/O latch.
• It can be programmed by mode 0 and mode 1.
PORT C:
• The eight bit ports of PORT C can be used as individual bits or be grouped into two 4 bit
ports. Cupper (Cu) and C Lower (CL).The functions of these ports are defined by writing a control
word in the control register.
Functions of Pin:
➢ It has 24 I/O programmable pins which can be grouped into three 8 bit parallel ports of Port A,
Port B and Port C.
➢ It is TTL compatible.
PA7-PA0: These are eight port A lines that acts as either latched output or buffered input lines depending
upon the control word loaded into the control word register.
PC7-PC4 : Upper nibble of port C lines. They may act as either output latches or input buffers lines. This
port also can be used for generation of handshake lines in mode 1 or mode 2.
4
PC3-PC0 : These are the lower port C lines, other details are the same as PC7-PC4 lines.
PB0-PB7 : These are the eight port B lines which are used as latched output lines or buffered input lines in
the same way as port A.
A1-A0: These are the address input lines and are driven by the microprocessor. These address lines A1-A0
are used for addressing any one of the four registers, i.e. three ports and a control word register as given
in table below.
RD : This is the input line driven by the microprocessor and should be low to indicate read operation to
8255.
WR : This is an input line driven by the microprocessor. A low on this line indicates write operation.
CS : This is a chip select line. If this line goes low, it enables the 8255 to respond to RD and WR signals,
otherwise RD and WR signal are neglected • In case of 8086 systems, if the 8255 is to be interfaced with
lower order data bus,the A0 and A1 pins of 8255 are connected with A1 and A2 respectively.
D0-D7 : These are the data bus lines those carry data or control word to/from the microprocessor.
RESET: A logic high on this line clears the control word register of 8255. All ports are set as input ports
by default after reset.
OPERATING MODES OF 8255
➢ BSR mode
➢ I/O mode
5
CONTROL WORD FORMATS:
• The PORT C can be Set or Reset by sending OUT instruction to the CONTROL registers.
• In BSR mode individual bits of Port C can be used for applications such as on/off switch.
• The control word sets or reset one bit at a time.
6
b) FOR I/O MODE
The I/O mode is divided into three modes mode 0, mode 1, and mode 2 given below
• Mode 0 – Basic I/O mode
• Mode 1 – strobbed I/O mode
• Mode 2 – Bidirectional data transfer mode
Steps to communicate with peripherals through the 8255 .They are
1. Determine the addresses of Port A,B and C and of the control register according to the chip select
logic and address line A0 and A1.
2. Write a control word in the control register
3. Write I/O instructions to communicate with peripherals through ports A, B and C.control word
does not alter any previously transmitted control word with bit D7=1.Thus the I/O operations of Port
A and Port B are not affected by a BSR control word.
I/O MODES:
7
➢ Features of mode 0 are:
• Any port can be input or output
• Outputs are latched
• Inputs are not latched
2) MODE 1: (Input/output with Hand shake)
In this mode, input or output is transferred by hand shaking Signals. The handshaking signals are
exchanged between the microprocessor and peripheral prior to data transfer.
➢ Features of mode 1
1. Two ports (A and B) function as 8 bit I/O ports .They can be configured either as input or output
ports.
2. Each port uses 3 lines from port C as handshake signals. The remaining 2 lines of PORT C can be
used for simple I/O operations.
• IBF (Input buffer full) If this signal rises to logic 1, it indicates that data has been loaded into
latches, i.e. it works as an acknowledgement. IBF is set by a low on STB and is reset by the rising
edge of RD input.
• INTR (Interrupt request) This active high output signal can be used to interrupt the CPU.
whenever an input device requests the service. INTR is set by a high STB pin and a high at IBF
pin.
➢ INTE is an internal flag that can be controlled by the bit set/reset mode of either PC 4(INTEA)
or PC2(INTEB) as shown in fig
➢ INTR is reset by a falling edge of RD input. Thus an external input device can be request the
service of the processor by putting the data on the bus and sending the strobe signal.
8
2.2) Output control signal(Mode 1) :
• OBF (Output buffer full) – This status signal, whenever falls to low, indicates that CPU has
written data to the specified output port. The OBF flip-flop will be set by a rising edge of WR
signal and reset by a low going edge at the ACK input.
• ACK (Acknowledge input) – ACK signal acts as an acknowledgement to be given by an output
device. ACK signal, whenever low, informs the CPU that the data transferred by the CPU to the
output device through the port is received by the output device.
• INTR (Interrupt request ) – Thus an output signal that can be used to interrupt the CPU when
an output device acknowledges the data received from the CPU.INTR is set when ACK, OBF
and INTE are 1. It is reset by a falling edge on WR input. The INTEA and INTEB flags are
controlled by the bit set-reset mode of PC6 and PC2 respectively.
9
3) MODE 2 :bi-directional I/O data transfer:
➢ Features of Mode2
• In this mode, Port A can be configured as the bidirectional port and Port B is either in Mode
0 or Mode 1.
• Port A uses 5 signals from Port C as handshake signals for data transfer .The remaining 3
signals from Port C can be used either as simple I/O or as handshake for Port B.
.
*******************************************************************************
Introduction:
The basic concepts concerning the serial I/O mode can be classified into the following categories
1. Interfacing Requirements
2. Alphanumeric codes
3. Transmission format
4. Error checks in data communication
5. Data communication over telephone lines
• Interfacing Requirements
[30 – 39H 0 to 9 ]
[41H– 5AH A to Z]
[21H – 2FH for various symbols]
[00 - 1FH for machine commands]
10
• Transmission format
➢ In synchronous format, receiver and a transmitter are synchronized with the same clock and a
block of character is transmitted along with the synchronization information. This format is
generally used for high speed transmission (more than 20 Kbits/second)
➢ The asynchronous format is character oriented. Each character carries the information of the start
and stop bits. Transmission starts with one start bit(low) followed by a character , and one or two
stop bits (high) .This is also known as framing. It is used in low speed transmission less than
20Kbits/second.
• Communication Modes
According to the direction and simultaneity of data flow, it is classified as
Simplex - Data are transmitted in only one direction.
Example: Transmission from a microcomputer to a printer.
Duplex - Data flow in both direction
• Half Duplex - If the transmission goes one way at a time it is called half duplex.
• Full Duplex – If both transmitting and receiving signals goes simultaneously, it is called full
duplex. Example: Transmission between computers.
• Rate of transmission
The rate at which the bits are transmitted is called bits/second or Baud rate. For example
1200 baud = 1200 bits/second. It indicates1200 bits are transmitted in a second. For 1 bit it
takes 1/1200 =0.83 ms.
11
***************************************************************************************
Explain USART (8251) serial communication interface with its functional block diagram.(April
2018)(June 2016)
*************************************************************************************
Definition:
The 8251 is a programmable USART (Universal Synchronous Asynchronous Receiver Transmitter)
is designed for Synchronous and Asynchronous serial communication; The 8251 receives parallel
data from the CPU and transmits serial data after conversion. This device also receives serial data
from the outside and transmits parallel data to the CPU after conversion.
➢ The control logic interfaces the chip with the MPU determines the functions of the chip
according to the control word in its register and monitors the data flow.
➢ The transmitter section converts a parallel word received from the MPU into a serial bits and
12
transmits them over TxD line to a peripheral.
➢ The receiver section receives serial bits from a peripheral converts them into parallel word and
transfers the word to the MPU.
➢ The MODEM control is used to establish data communication through modems over telephone
lines.
1. Transmitter section
➢ The transmitter accepts parallel data from the MPU and converts them into serial data.
➢ It has two registers, A buffer register to hold eight bits and an output register to convert eight
bits into a stream of serial bits.
➢ The MPU writes a byte in the buffer register whenever the output register is empty, the contents
of the buffer register are transferred to the output register.
➢ This section transmits data on the TxD pin with the appropriate framing bits(start & stop).3 output
and 1 input signal are associated with transmitter section.
2. Receiver Section
➢ The receiver accepts serial data on the RxD line from a peripheral and converts them into parallel
data.
➢ The section has two registers, the receiver input register and the buffer register.
➢ When RxD line goes low, the control logic assumes it is a start bit, waits for half a bit time and
samples the line again. If the line is still low, the i/p register accepts the following bits, forms a
character and loads it into the buffer register subsequently. The parallel byte is transferred to the
Microprocessor when requested.
RXD (Receive Data)
The bits are received serially on this line and converted into a parallel byte in the receiver input
register.
13
RXC (Receiver clock)
This clock signal controls the rate at which bits are received by the USART .In asynchronous
mode, the clock can be set to 1,16 and 64 times the baud.
In "asynchronous mode," this is an output terminal which generates "high level" output upon the detection
of a "break" character if receiver data contains a "low-level" space between the stop bits of two continuous
characters.
3. MODEM Control
.
1. DSR ( Data set ready)
This is an input port for MODEM interface. This is normally used to check if the Data set is ready
when communicating with a modem.
2. DTR ( Data terminal ready)
This is an output port for MODEM interface. It is used to indicate that the device is ready to accept
data when the 8251 is communicating with a modem.
3. CTS ( Clear to send)
This is an input terminal for MODEM interface which is used for controlling a transmit circuit. The
terminal controls data transmission if the device is set in "Tx Enable" status by a command. Data is
transmittable if the terminal is at low level.
4. RTS ( Request to send data)
This is an output port for MODEM interface. It is used to indicate the MODEM that the receiver is
ready to receive a data byte from the MODEM.
Status Register
This input register checks the ready status of a peripheral. This register is addressed as an input port when
the C /D is high .It has the same port address as the control register.
Data Buffer
This bidirectional register can be addressed as an input port and an output port when C/D pin is low.
15
8251 command word
Pin Description
❖ Initializing the 8251
• To implement serial communication, the MPU must inform 8251 of all details such as mode, baud ,
stop bits, parity etc.,
• Therefore prior to data transfer ,a set of control words must be loaded into the 16 bit control register
of the 8251.The MP must check the readiness of a peripheral by reading the status register.
16
• The control words are divided into two formats: Mode word and command word.
• The mode word specifies the general characteristics of operation (such as baud, parity, number of
stop bits) .The command word enables data transmission and/or reception and the status word
provide the information concerning register status and transmission errors.
*******************************************************************************
Draw the block diagram of 8279 Keyboard/Display controller and explain how to interface the Hex
Key Pad and 7-segment LEDs using 8279. (December 2017)
******************************************************************************
Definition:
A 8279 is a general purpose keyboard display controller that simultaneously drives the display of a
system and interferes a keyboard with the CPU, leaving it free for routine task.
17
Basic Description of the 8279
18
RL0-RL7:
• Input return lines which are connected to the scan lines through the keys or sensor
switches. They have active internal pull-ups to keep them high serve as an 8- bit input in the
strobed input mode.
SHIFT:
• It has an active internal pull-up to keep it high until a switch closure pulls it low.
CNTL/STB:
• For keyboard mode, this line is used as a control input and stored like status on a key
closure.
• The line is also the strobed line to enter the data into the FIFO in the strobed input.
OUT A0 – OUT A3, OUT B0 – OUT B3:
• These two ports are the outputs for the 16x4 display refresh registers. These two ports may
also be considered as one 8 – bit port.
• The two 4 – bit ports may be blanked independently.
BD:
This output is used to blank the display digit switching or by a display banking command.
************************************************************************************
Explain the working Principle of 8279 Keyboard/Display Controller.(April 2010)(June 2016)
(December 2016)(May 2015)(December 2015)
*************************************************************************************
19
Figure:8279 keyboard /Display Interface
• It consists of
a) A set of four scan lines and eight return lines for interfacing keyboards
b) A set of eight output lines for interfacing display.
A0 RD WR Operation
0 0 0 MPU writes the data is 8279
0 0 1 MPU reads the data from 8279
1 1 0 MPU writes control word to 8279
1 0 1 MPU read status word from 8279
KEYBOARD SECTION:
• This section has keyboard debounce and control, 8X8 FIFO/sensor RAM, 8 return lines
(RL0 – RL7) and CNTL/STB and shift lines.
• In the keyboard debounce and control unit, keys are automatically debounced and the
keyboard can be operated in two modes.
➢ Two keys lock out
➢ N – key roll over
• The 8X8 FIFO/sensor RAM consists of 8 registers that are used to store eight keyboard
entries.
20
• The return lines (RL0-RL7) are connected to eight columns of keyboard.
• The status of shift and CNTL/STB lines are stored along with the key closure.
SCAN SECTION:
• This section has scan counter and four scan lines (SL0 – SL3).
• These lines are decoded by 4 to 16 decoder to generate 16 scan lines.
• Generally SL0 – SL3 are connected with the rows of a matrix keyboard.
DISPLAY SECTION:
• This section has two groups of outputs lines A0 – A3 and B0 – B3. These lines are used to
send data to display drivers.
• BD line is used blank the display. It also has 16X8 displays RAM.
• The display address register holds the address of the word currently being written or read by
the CPU to or from the display RAM.
• The contents of the registers are automatically updated by 8279 to accept the next data entry by
CPU.
Modes of operations of 8279
1. Keyboard modes
❖ Scanned keyboard mode with N key rollover
In this mode, each key depression is treated independently. When a key is pressed, the debounce
circuit waits for 2 keyboards scans and then checks whether the key is still depressed. If it is still
depressed, the code is entered in FIFO RAM
❖ Scanned keyboard mode with 2 key lock out.
It prevents 2 keys from being recognized if pressed simultaneously. If two keys are pressed within
a debounce cycle (simultaneously),no key is recognized till one of them remains
closed, and the other is released. The last key that remains depressed is considered as single valid
key depression.
2. Display modes
21
Command Words of 8279
22
DD field selects either: 8- or 16-digit display Whether new data are entered to the rightmost or
leftmost display position.
**************************************************************************************
Draw and explain the functional block diagram of 8254 Timer and its command word
format.[ May/June 2016, Nov/Dec 2016, May/June 2013, May/June 2009][Dec 2017]
Explain the blocks diagram and modes of the 8254 timer. {Nov/Dec 2015 .Dec 2012,June 2014]
************************************************************************** ***********
Definition:
The 8254 is a programmable interval timer/counter is used for the generation of accurate time delays ,
controlling real-time events such as real-time clock, events counter, and motor speed and direction control
under software control.
After the desired delay, the 8254 will interrupt the CPU. This makes microprocessor to be free the
tasks related to the counting process and can execute the programs in memory, while the timer device may
perform the counting tasks. This minimizes the Software overhead on the microprocessor.
Application of 8254:
• Real time clock
• Event-counter
• Digital one-shot
• Programmable rate generator
• Square wave generator
• Binary rate multiplier
• Complex waveform generator
• Complex motor controller
It consists of
• Three independent 16-bit programmable counters (timers)
• a data bus buffer
• Read/Write control Logic
• Control register
24
8254 Functional Block diagram of 8253
This 3- state, bi-directional, 8-bit buffer is used to interface the 8254 to the system bus.
READ/WRITE LOGIC:
➢ The Read/Write logic accepts inputs from the system bus and generates control signals for
the other functional blocks of the 8254.
➢ A1 and A0 select one of the three contents counters or the control word register to be read
from/written into.
➢ A “low” on the RD input tells the 8254 that the CPU is reading one of the counters.
➢ A “low” on the WR input tells the 8254 that the CPU is writing either a control word or an
initial count.
➢ Both RD and WR are qualified by CS; RD and WR are ignored unless than 8254 has been
selected by holding CS low.
➢ The control word register is selected by the read/write logic when A1, A0=11.
➢ If the CPU then does a write operation to the 8254, the data is stored in the control word
register and is interpreted as a control word used to define the operation of the counters.
25
➢ The control word register can only be written to; status information is available with the
Read-Back command.
D0 to D7 : read, write, Chip select & Address pins A1 and A0 are connected to Microprocessor
A1, A0 The address inputs select one of the four internal registers for programming, reading, or
writing to a counter.
CLK: The clock input is the timing source for each of the internal counters. It is often connected to
the PCLK signal from the bus controller
CS: Chip Select enables the 8254 for programming, and reading and writing
Gate: The gate input controls the operation of the counter in some modes
OUT: A counter output is where the wave-form generated by the timer is available
26
Read/Write causes data to be read/written from the 8254 and often connects to the
Each counter may be programmed with a count of 1 to FFFFH. Minimum count is 1 all modes
except 2 and 3 with minimum count of 2.
Each counter has a program control word used to select the way the counter operates.
If two bytes are programmed, then the first byte (LSB) stops the count, and the second byte
(MSB) starts the counter with the new count.
****************************************************************************************
Explain the various modes of operation of timer interface 8253/8254.[Dec 2013,Dec 2015,Dec 2016]
**************************************************************************************
There are 6 modes of operation for each counter
1. MODE 0: INTERRUPT ON TERMINAL COUNT :
2. MODE 1: Programmable One-Shot:
3. MODE 2: RATE GENERATOR:
4. MODE 3: SQUARE WAVE GENERATOR
5. MODE 4: SOFTWARE TRIGGERED STROBE :
6. MODE 5: HARDWARE TRIGGERED STROBE (RETRIGGERABLE):
Modes of operation
27
MODE 0: INTERRUPT ON TERMINAL COUNT:
➢ Mode 0 is typically used for event counting. After the Control Word is written, OUT is initially
low, and will remain low until the Counter reaches zero.
➢ OUT then goes high and remains high until a new count or a new Mode 0 Control Word is written
into the Counter.
➢ GATE = 1 enables counting; GATE = 0 disables counting. GATE has no effect on OUT.
➢ The output becomes a logic 0 when the control word is written and remains there until N plus the
number of programmed counts.
28
MODE 3: SQUARE WAVE GENERATOR
➢ Mode 3 is typically used for Baud rate generation. Mode 3 is similar to Mode 2 except for the
duty cycle of OUT. OUT will initially be high.
➢ When half the initial count has expired, OUT goes low for the remainder of the count. Mode 3
is periodic; the sequence above is repeated indefinitely.
➢ An initial count of N results in a square wave with a period of N CLK cycles.GATE = 1
enables counting; GATE = 0 disables counting. If GATE goes low.while OUT is low, OUT is
set high immediately; no CLK pulse is required.
➢ Even counts: OUT is initially high. The initial count is loaded on one CLK pulse and then is
decremented by two on succeeding CLK pulses.
➢ When the count expires OUT changes value and the Counter is reloaded with the initial count.
The above process is repeated indefinitely.so for odd counts, OUT will be high for (N + 1)/2
counts and low for (N - 1)/2 counts
OUT will initially be high. Counting is triggered by a rising edge of GATE. When the initial count
has expired, OUT will go low for one CLK pulse and then go high again. G controls similar to
Mode 1.
Trigger with count of 5
29
*******************************************************************************
Explain the working principle of 8257 DMA controller interface. (June 2016)
What is DMA? Explain the DMA based data transfer sing DMA controller (April 2015)
*******************************************************************************
6. Direct Memory Access
Direct memory access (DMA) or DMA mode of data transfer is the fastest amongst all the modes of
data transfer. In this mode, the device may transfer data directly to/from memory without any
interference from the CPU.
DMA Controller
The DMA controller (8257) allows certain hardware subsystems to read/write data to/from memory
without microprocessor intervention, allowing the processor to do other work.
.
1 2 3 4 5 6 7 8 9
CLK
HOLD
HLDA
It is used in disk controllers, video/sound cards etc, or between memory locations. Typically, the
CPU initiates DMA transfer, does other operations while the transfer is in progress, and receives an
interrupt from the DMA controller once the operation is complete.
30
Figure:8237 DMA controller
31
Internal registers
• The current address register (CAR) is used to hold the 16-bit memory address used for the
DMA transfer.
• The current word count register (CWCR) programs a channel for the number of bytes (up
to 64K) transferred during a DMA action.
• The base address (BA) and base word count (BWC) registers are used when auto-
initialization
• is selected for a channel. In this mode, their contents will be reloaded to the CAR and CWCR
after the DMA action is completed.
• Each channel has its own CAR, CWCR, BA and BWC.
• The command register (CR) programs the operation of the 8237 DMA controller
• The mode register (MR) programs the mode of operation for a channel.
• The request register (RR) is used to request a DMA transfer via software, which is very
useful in memory-to-memory transfers.
• The mask register set/reset (MRSR) sets or clears the channel mask to disable or enable
particular DMA channels.
• The status register shows the status of each DMA channel.
DMA channels:
The 8257 provides four identical channels labeled CH0, CH1, CH2 and CH3. Each channel has two-16
bit registers. They are
1. DMA address register
2. Terminal count register
1. DMA address register:
➢ It specifies the address of the first memory location to be accessed.
32
➢ It is necessary to load valid memory address in the DMA address register before channel is
enabled.
2. Terminal count register:
➢ The value loaded into the low order 14 bits of TCR specifies the number of DMA cycles
minus one (N-1) before TC output is activated.
➢ Therefore, for N number of desired DMA cycles it is necessary to load the value N-1 into
the low order 14 bits of TCR.
➢ MSB 2 bits specify the type of operation to be performed.
Control Logic:
• It controls the sequence of operations during all DMA cycles by generating the appropriate control
signals and the 16 bit address that specified the memory location to be accessed.
• It consists of mode set register and status register.
• Mode set register is programmed by the CPU to configure 8257 whereas the status register is read
by CPU to check which channels have reached a terminal count condition and status of update flag.
➢ STATUS REGISTER:
• It indicates which channels have reached a terminal count condition and includes the
update flag.
33
• The Tc status bit=1, terminal count has been reached for that channel.
• Tc bit remains set until the status register is read or the 8257 is reset.
• Update flag =1, 8257 is executing update cycle
• In update cycle 8257 lad parameters in channel 3 to channel 2.
PRIORITY RESOLVER:
It resolves the peripherals request. It can be programmed to work into two modes, either fixed
mode or rotating priority mode.
➢ A DMA controller is capable of becoming the bus master and supervising a transfer between an
I/O or mass storage interface and memory. While making a transfer, it must be able to place
memory address on the bus and send and receive handshaking signals in a manner similar to that
of the bus control logic. The purpose of a DMA controller is to perform a sequence of transfers (ie
a block transfer) by stealing bus cycles.
➢ A DMA controller is designed to service one or more I/O mass storage interfaces, and each
interface is connected to the controller by a set of conductors. A portion of a DMA controller for
servicing a single interface is called a channel..
➢ The general organization of a one channel DMA controller and its principal connection is shown
in figure. In addition to the usual control and status registers, each channel must contain an
address register and a byte (or word) count register.
➢ Initializing the controller consists of filling these registers with the beginning (or ending) address
of the memory array that is to be used as a buffer and the number of bytes (words) to be
transferred .For an input to memory, each time the interface has data to transfer it makes a DMA
request
➢ The controller then makes a bus request and when it receives a bus grant, it puts the contents of
the address register on the address bus, sends an acknowledgement back to the interface, and
issues I/O read and memory write signals. The interface then puts the data on the data bus and
drops its request.
➢ When the memory accepts the data it returns a ready signal to the controller, which then
increments (or decrements) the address register, decrements the byte (word) count, and drops its
bus request.
➢ Upon the count reaching zero, the process stops and a signal is sent to the processor as an
interrupt request or to the interface to notify it that the transfers have terminated. An output is
similarly executed except that the controller issues I/O write and memory read signals and the
data are transferred in the other direction.
Each channel may be put in one of four modes,with its current mode being determined by bits 7
and6 of the channel’s mode register .The four possible modes are
35
a) Byte b) Burst c) Block
Burst-mode: DMA transfer is finished when all data has been moved.
***************************************************************************************
Draw the block diagram of 8259A and explain how to program 8259A (April 2010).(Dec 2018)
Explain the working of 8259 with a neat block diagram . (Nov/Dec 2016/April 2015)
**********************************************************************************
36
7. Programmable Interrupt controller (8259)
Definition:
• The Intel 8259 Programmable Interrupt Controller handles up to eight vectored priority interrupts or
the CPU.It is cascadable for up to 64 vectored priority interrupts without additional circuitry. It is
packaged in a 28-pin DIP, uses NMOS technology and requires a single a5V supply.
• It accepts requests from the peripheral equipment, determines which of the incoming requests is of
the highest importance (priority), ascertains whether the incoming request has a higher priority value
than the level currently being serviced, and issues an interrupt to the CPU based on this
determination.
➢ Interrupt Request Register (RR): IRR stores all the interrupt request in it in order to serve them
one by one on the priority basis.
➢ In-Service Register (ISR): This stores all the interrupt requests those are being served, i.e. ISR
keeps a track of the requests being served.
➢ Priority Resolver: This unit determines the priorities of the interrupt requests appearing
simultaneously. The highest priority is selected and stored into the corresponding bit of ISR
during INTA pulse. The IR0 has the highest priority while the IR7 has the lowest one, normally in
fixed priority mode. The priorities however may be altered by programming the 8259A in rotating
priority mode.
37
➢ Interrupt Mask Register (IMR) : This register stores the bits required to mask the interrupt
inputs. IMR operates on IRR at the direction of the Priority Resolver.
Interrupt Control Logic: This block manages the interrupt and interrupt acknowledge signals to
be sent to the CPU for serving one of the eight interrupt requests. This also accepts the interrupt
acknowledge (INTA) signal from CPU that causes the 8259A to release vector address on to the
data bus.
➢ Data Bus Buffer: This tristate bidirectional buffer interfaces internal 8259A bus to the
microprocessor system data bus. Control words, status and vector information pass through data
buffer during read or write operations.
➢ Read/Write Control Logic: This circuit accepts and decodes commands from the CPU. This
block also allows the status of the 8259A to be transferred on to the data bus.
➢ Cascade Buffer/Comparator: This block stores and compares the ID’s all the 8259A used in
system. The three I/O pins CASO-2 are outputs when the 8259A is used as a master. The same
pins act as inputs when the 8259A is in slave mode. The 8259A in master mode sends the ID of
the interrupting slave device on these lines. The slave thus selected, will send its preprogrammed
vector address on the data bus during the next INTA pulse.
➢ CS: This is an active-low chip select signal for enabling RD and WR operations of 8259A. INTA
function is independent of CS.
➢ WR: This pin is an active-low write enable input to 8259A. This enables it to accept command
words from CPU.
➢ RD: This is an active-low read enable input to 8259A. A low on this line enables 8259A to
release status onto the data bus of CPU.
➢ D0-D7 : These pins from a bidirectional data bus that carries 8-bit data either to control word or
from status word registers. This also carries interrupt vector information.
➢ CAS0 – CAS2 Cascade Lines: A signal 8259A provides eight vectored interrupts. If more
interrupts are required, the 8259A is used in cascade mode. In cascade mode, a master 8259A
along with eight slaves 8259A can provide up to 64 vectored interrupt lines. These three lines act
as select lines for addressing the slave 8259A.
➢ PS/EN: This pin is a dual purpose pin. When the chip is used in buffered mode, it can be used as
buffered enable to control buffer transreceivers. If this is not used in buffered mode then the pin is
used as input to designate whether the chip is used as a master (SP =1) or slave (SP = 0).
➢ INT: This pin goes high whenever a valid interrupt request is asserted. This is used to interrupt
the CPU and is connected to the interrupt input of CPU.
➢ IR0 – IR7 (Interrupt requests) :These pins act as inputs to accept interrupt request to the CPU.
In edge triggered mode, an interrupt service is requested by raising an IR pin from a low to a high
38
state and holding it high until it is acknowledged, and just by latching it to high level, if used in
level triggered mode.
➢ A0 : This input signal is used in conjunction with WR and RD signals to write commands into the
various command registers, as well as reading the various status registers of the chip. This line
can be tied directly to one of the address lines.
The 8259A accepts two types of command words generated by the CPU:
1. One or more IR lines are raised high that set corresponding IRR bits.
4. Upon receiving an INTA signal from the CPU, the highest priority ISR bit is set and the
corresponding IRR bit is reset. The 8259 will also release a CALL instruction code (11001101) on to
the 8 bit data through its D7 - D0 pins.
5. The CALL instruction will initiate a second INTA pulse. During this period 8259A releases an 8-bit
pointer on to a data bus from two more INTA pulses to be sent to the 8259 from the CPU group.
6. These two INTA pulses allow the 8259 to release its programmed subroutine address onto the data bits.
The lower 8 bit address is released at the first INTA pulse and the higher 8 bit address is released at the
second INTA pulse.
7. This completes the 3 byte CALL instruction released by the 8259. Interrupt cycle. The ISR bit is
reset at the end of the second INTA pulse if automatic end of interrupt (AEOI) mode is programmed.
Otherwise ISR bit remains set until an appropriate EOI command is issued at the end of interrupt
subroutine.
39
❖ Priority Modes
Example:
reset
40
Command and Status Words of 8259
****************************************************************************************
Explain A/D interface with 8085 with neat sketch.(Dec 2014)
Explain how D/A and A/D interfacing done with 8085with an application(April 2015)(Dec 2017)
***************************************************************************************
8.Analog to digital conversion
➢ The process of analog to digital conversion is a slow process, and the microprocessor has to wait
for the digital data till the conversion is over.
➢ After the conversion is over, the ADC sends end of conversion EOC signal to inform the
microprocessor that the conversion is over and the result is ready at the output buffer of the ADC.
These tasks of issuing an SOC pulse to ADC, reading EOC signal from the ADC and reading the
digital output of the ADC are carried out by the CPU using 8255 I/O ports.
➢ The time taken by the ADC from the active edge of SOC pulse till the active edge of EOC signal is
called as the conversion delay of the ADC.
➢ It may range anywhere from a few microseconds in case of fast ADC to even a few hundred
milliseconds in case of slow ADCs.
41