Professional Documents
Culture Documents
Interrupt driven I/ O
Memory Address
Space I/O address Space
14-bits B0-B13 is used to count value and a 2-bits is used for indicate
the type of DMA transfer (Read/Write/Veri1 transfer).
Data Bus Buffer:
It contain 8 bit bi-directional buffer.
Slave mode ,it transfer data between microprocessor and internal
data bus.
Master mode ,the outputs A8-A15 bits of memory address on data
li
lines (U idi i l)
(Unidirectional).
Read/Control Logic:
It control all internal Read/Write operation.
Slave mode ,it accepts address bits and control signal from
microprocessor.
i
Master mode ,it generate address bits and control signal.
Control logic block:
It contains
i ,
1. Control logic
2. Mode set register
3. Status Register.
Control Logic:
Master mode ,It control the sequence of DMA operation during all
DMA cycles.
It generates address and control signals.
It activate a HRQ(Hold ReQuest) signal on DMA channel Request.
Slave mode, it is disabled.
Mode Set Registers:
It is a write only registers.
registers
It is used to set the operating modes.
This registers is programmed after initialization of DMA channel.
The use of mode set register is,
is
1. Enable/disable a channel.
2. Fixed/rotatingg p
priorityy
3. Stop DMA on terminal count.
4. Extended/normal write time.
5. Auto reloading of channel-2.
Status Registers:
It is read only registers, It tell the status of DMA channels.
These status bits are cleared after a read operation by microprocessor.
microprocessor
Update flag is not affected during read operation and a one in this bit
position indicates that the channel-2 register has been reloaded from
channel-3 registers in the auto load mode of operation.
The UP bit is set during update cycle . It is cleared after completion of
update cycle.
Interfacing 8257 with 8086
Thee DMA co controller
t o e sesends
ds a HOLD
O request
equest to tthee C
CPU
U aandd wa
waits
ts for
o
the CPU to assert the HLDA signal. The CPU relinquishes the
control of the bus before asserting the HLDA signal.
Programmable Interval Timer 8253 (PIT)
Features
1. Three 16-bit independent counters.
2. Three counters are identical pre-settable, and can be programmed
f either
for ith binary
bi or BCD count.t
3. Counter can be programmed in six different modes.
4 Compatible with all Intel and most other microprocessors.
4. microprocessors
5. can operate upto 2.6 MHz.
6. Used for controlling real time events RT clock, events counter etc
Block Diagram
Counter
Each counter is assigned an individual port address.
The control register common to all 3 counters.
Each counter in the block diagram has 3 lines connected to it.
Two of these lines,, clock and g
gate,, are inputs.
p The third,, labeled OUT
is an output.
The function of these lines changes and depends on how the device is
initialized or programmed.
control word
Allows the programmer to select the counter, model of operation,
bi
binary or BCD count andd type off operation
i
Data Bus Buffer
bi-directional, 8-bit buffer is used to interface the 8253 to the system
data bus.
The Data bus buffer has three basic functions.
1. Programming the modes of 8253/54.
2. Loading the count registers.
3. Reading the count values.
Operation Modes
Mode 0: Set Output Bit when timer done.
The output will start off zero. The count is loaded and the timer
will
ill start
t t to
t countt down.
d
When the count has reached zero the output will be set high, and
remain high until the next count has been reloaded.
reloaded
Mode 1: Programmable One-Shot.
The output will go low following the rising edge of the gate input.
The
Th counter will
ill count andd the
h output will
ill go high
hi h once the
h counter
has reached zero.
.
Mode 2: Rate Generator.
The counter will continually count down,
down when the count reaches
zero, the output will pulse low and the counter will be reloaded
Mode 3: Square Wave Generator.
This mode is similar to Mode 2 except the output t t remains low for
half of the timer period and high for the other half of the period.
Mode 4: Software Triggered Pulse.
The output
p will remain high g until the timer has counted to zero,, at
which point the output will pulse low and then go high again.
Mode 5: Hardware Triggered Pulse.
The counter will start countingg once the ggate input
p g goes high,
g when
the counter reaches zero the output will pulse low and then go high
again.
P
Programmable
bl Interrupt
I t t Controller
C t ll 8259
The Programmable Interrupt Controller (PIC) functions as an overall
manager in an Interrupt-Driven system environment.
Able to handle a number of interrupts at a time.
Takes care of a number of simultaneously appearing interrupt requests
along with their types and priorities.
Compatible with 8-bit
8 bit as well as 16-bit
16 bit processors.
processors
deal with up to 64 interrupt inputs.
interrupts
te upts ca
can be masked.
as ed.
various priority schemes can also programmed.
8259A PIC- BLOCK DIAGRAM
It includes 8 blocks.
Control logic
Read/Write logic
Data bus buffer
Three registers (IRR,ISR and IMR)
Priority resolver
Cascade Buffer
Interrupt Request Register (IRR) and In-Service Register (ISR)
The
h interrupts
i at the
h IR input
i li
lines are handled
h dl d by b two registers
i i
in
cascade, the Interrupt Request Register (lRR) and the In- Service
Register (lSR).
(lSR)
The IRR is used to indicate all the interrupt levels which are
requesting service.
service
ISR is used to store all the interrupt levels which are currently being
serviced
Priority Resolver
This logic block determines the priorities of the bits set in the lRR.
The highest priority is selected and strobed into the corresponding bit
of the lSR duringg the INTA sequence.
q
Interrupt Mask Register (IMR)
The lMR stores the bits which disable the interrupt lines to be masked.
The IMR operates on the output of the IRR.
Data Bus Buffer
This bidirectional 8-bit buffer is used to interface the 8259A to the
system Data Bus.
Control words and status information are transferred through the Data
Bus Buffer
Read-Write Logic
accept OUTput commands from the CPU. CPU
contains the Initialization Command Word (ICW) registers and
Operation Command Word (OCW) registers which store the various
control formats for device operation.
allows the status of the 8259A to be transferred onto the Data Bus
The Cascade Buffer/Comparator
stores and compares the IDs of all 8259A's used in the system. The
associated three I/O pins (CAS0-2) are outputs when the 8259A is
used as a master and are inputs when the 8259A is used as a slave.
As
A a master, the
h 8259A sends d the
h ID off the
h interrupting
i i slave
l d i
device
onto the CAS 0-2 lines. The slave thus selected will send its
preprogrammed subroutine address onto the Data Bus during the
next one or two consecutive INTA pulses.
Interfacing 8259 with 8086
IInterrupt
t t Sequence
S
1. One or more of the INTERRUPT REQUEST lines are raised high,
setting the corresponding IRR bit(s).
bit(s)
2. The 8259A evaluates these requests, and sends an INT to the CPU, if
appropriate.
i t
3. The CPU acknowledges the INT and responds with an INTA pulse.
4 Upon
4. U receiving
i i an INTA from f the
h CPU , the
h highest
hi h priority
i i ISR bit
bi is
i
set and the corresponding IRR bit is reset.
5 The 8086 will
5. ill initiate another two
t o INTA pulses.
p lses
6. This completes the interrupt cycle. In the AEOI(Automatic End of
Interrupt) mode the ISR bit is reset at the end of the second INTA
pulse. Otherwise, the ISR bit remains set until an appropriate EOI(End
of Interruptp Mode)) command is issued at the end of the interrupt p
subroutine.
PROGRAMMING THE 8259A
The 8259A accepts two types of command words generated by the
CPU:
1 Initialization
1. I iti li ti Command
C d Words
W d (ICWs):Before
(ICW ) B f start
t t functioning,
f ti i 8259
must be initialized by writing two to four command words into their
respective command word registers.
registers
2. Operation Command Words (OCWs): These are the command words
which command the 8259Ato operate in various interrupt modes.
8259A- OPERATING MODES
1 FULLY NESTED
1.
2. AUTOMATIC ROTATION
3 SPECIFIC ROTATION
3.
4. END OF INTERRUPT
5 AUTOMATIC EOI
5.
1. FULLY NESTED
General
G l purpose mode,
d All IRs
IR are arrangedd from
f hi h t to
highest t lowest.
l t
IR0 Highest IR7Lowest
2 AUTOMATIC ROTATION MODE
2.
In this mode, a device after being serviced, receives the lowest
priority.
priority
3. SPECIFIC ROTATION MODE
Similar to automatic rotation mode, except that the user can select
any IR for the lowest priority, thus fixing all other priorities.
4. END OF INTERRUPT (EOI)
After the completion of an interrupt service, the corresponding ISR
bi needs
bits d to beb reset to update
d the
h information
i f i ini the
h ISR.
ISR This
Thi is
i
called EOI command
5 AUTOMATIC EOI
5.
In this mode, no command is necessary.
During
D i the th third
thi d interrupt
i t t acknowledge
k l d cycle,l the
th ISR bit is
i reset.
t
8251A pprogrammable
g Communication Interface
USART (Universal Synchronous Asynchronous Receiver
Transmitter)
i )
designed for synchronous /asynchronous serial data
communication,
i ti packaged
k d in i a 28-pin
28 i DIP.
DIP
Receives parallel data from the CPU & transmits serial data after
conversion.
conversion
Also receives serial data from the outside & transmits parallel data
to the CPU after conversion.
conversion
Block diagram
F ti l Blocks
Functional Bl k off 8251A
1. Data Bus buffer
2 Read/Write Control Logic
2.
3. Modem Control
4 Transmitter
4.
5. Receiver
CS C/D WR RD Operation
0 0 1 0 MPU reads data from data buffer
0 0 0 1 MPU writes data from data buffer
0 1 0 1 MPU writes
it a word d tto control
t l register
it
0 1 1 0 MPU reads a word from status register
1 × × × Chip is not selected for any operation
3. Modem Control
The modem control unit handles the modem handshake signals to
coordinate the communication between the modem and the USART.
4 Transmitter section
4.
Accepts parallel data from MPU & converts them into serial data.
Has two registers:
g
Buffer register : To hold eight bits
Output
p register
g : To convert eight
g bits into a stream of serial bits.
The MPU writes a byte in the buffer register.
Whenever the output p register
g is empty;
p y; the contents of buffer
register are transferred to output register.
5. Receiver Section
Accepts serial data on the RxD pin and converts them to parallel data.
data
Has two registers :
Receiver
Receiver input register
Buffer register
Operating Modes of 8251
1 Asynchronous mode(Txt and Rcv)
1.
2. Synchronous mode(Txt and Rcv)
Asynchronous Mode (Transmission)
When a data character is sent to 8251A by the CPU, it adds start bits
prior to the serial data bits,
bits followed by optional parity bit and stop bits
using the asynchronous mode instruction control word format. This
sequence is then transmitted using TXD output pin on the falling edge
of TXC.
Asynchronous Mode (Receive)
The receiver requires only one stop bit to mark end of the data bit
string. The 8-bit character is then loaded into the into parallel I/O
b ff off 8251.
buffer 8251 RXRDY pin i is
i raised
i d high
hi h to
t indicate
i di t to
t the
th CPU that
th t a
character is ready for it.
Synchronous Mode (Transmission)
The TXD output is high until the CPU sends a character to
8251 which usually is a SYNC character. If the CPU buffer
becomes empty,
empty the SYNC character or characters are inserted
in the data stream over TXD output.