New Microsoft Word Document
New Microsoft Word Document
INTRODUCTION
Microprocessor based system design involves interfacing of the processor with one or more
peripheral devices for the purpose of communication with various input and output devices
connected to it. During the early days of the microprocessor revolution, these techniques
required complex hardware consisting of Medium scale integration devices making the
design highly complex and time consuming. So, the manufacturers (INTEL) have developed
a large number of general and special purpose peripheral devices most of them being single
chip circuits. They are also programmable devices. Hence these peripheral devices are found
to be of tremendous use to a system designer.
Peripheral devices can broadly be classified into two categories.
General purpose peripheral devices that perform a task but may be used for interfacing a
variety of I/O devices to microprocessor. The general purpose devices are given below:
Iv .It is available in 40 pin DIP and 44 pin plastic leaded chip carrier (PLCC) packages.
v. It has three 8 bit ports. Port A, Port B and Port C. Port C is treated as two 4 bit ports
also.
vi. This 8255 is mainly programmed in two modes (a) the I/O mode and (b) The bit
set/reset mode (BSR) mode. The I/O mode is further divided into three modes: Mode 0,
Mode 1, and Mode 2.
vii. An 8 bit control resister is used to configure the modes of 8255.
There is also another 8 bit port called control port, which decides the configuration of 8255
ports. This port is written by the microprocessor only.
PIN CONFIGURATION OF 8255:
• D0-D7 (DataBus): Bidirectional, tri-state, databus lines connectedto the system data
bus.They are used to transfer data and control word from microprocessor to 8255 or receive
data or status word from 8255 to 8085.
• PA0-PA7(PortA): These 8-bit bidirectional I/O pins are used to send or receive data
from O/P or I/P device.
• PB0-PB7(Port B): These 8-bitbidirectionalI/Opins areused to send or receive
datafrom O/P or I/P device.
Figure 1: Pin Diagram of 8255 Table 1: Pin Description
• PC0- PC7(port C): These 8-bit bidirectional I/O pins are divided into two groups PCL
(PC0- PC3)and PCU (PC4- PC7). These groups can individually transfer data in or out when
programmed I/O. When programmed in bidirectional or handshake modes these bits are used
as handshake signals.
• RD’ (Read): MPU or CPU reads data in the ports or the status word through data
buffer.
• WR’ (Write): MPU or CPU writes data in the ports or the control register through
data Buffer.
• CS’ (Chip Select): It is an active below inputwhichcan be used to enable 8255for data
transfer operation betweenCPU (MPU) and 8255.
• RESET: It is an active high input used to reset 8255. When reset input is high, the
control register is cleared and allthe ports are set to the input mode. Usually RESETOUT
signal from 8085 is used to reset 8255.
• A0&A1: These input signals along with RD’, WR’ inputs control the selection of
control / status word registers or one of three ports.
Tri-state bidirectional buffer is usedto interface the internal data bus of8255 to the system
data bus. Output data from the MPU to the ports or control register and the input datato the
MPU from the ports or status register are all pushed through the buffer.
• Control Logic
This block accepts control bus signalsas well as inputs from the address bus and issues
commands to the individual groupcontrol blocks (Group A Control and GroupBControl)as
shown in Fig.2.
• Group AControl and Group B Control
GroupA control block controls PortA and PC7-PC4.Group B controls block controlsPort
Band PC3- PC0.
• PortA
This has 8-bit latched and buffered output and an 8-bit input latch. It can be
programmedinthreemodes:
Mode 0:SimpleI/Omode
Mode 1: I/OwithHandshakingmode
Mode 2: Bidirectionaldatatransfermode.
• Port B
This has 8-bit I/O latch/buffer and an 8-bit data input buffer. It can be programmed in mode 0
or mode 1.
• Port C
This has 8-bit unlatched input buffer and an 8-bit output latch/buffer. Port C can
besplittedintotwo parts and each bit can be used as control signals for Port A and Port B
inhandshake mode. It can be programmed for BSR (Bit Set / Reset mode) operation.
Modes of Operation:
1. BSRmode
2. I/O mode
Mode 0: SimpleI/Omode
Mode 1 : I/OwithHandshakingmode
Mode 2: Bidirectionaldatatransfermode
1. BSR (Bit Set/Reset) Mode:
Individual bits of Port C can be set or reset by sending out a single OUT instruction to the
control register. When Port C is used for control/status operation, this feature can be used to
set or reset individual bits. For BSR mode control word is given below.
• The 5-bit control port (port C) is used for control as well as for status of the 8-bit
bidirectionalbus port (portA).
Priority Resolver
This logic unit determines the priorities of the bits set in the IRR. The highest priority is
selected and strobed in to the corresponding bit of the ISR during pulse.
Control Logic
This unit has two pins. INT (Interrupt) as an output pin and (interrupt acknowledge) as an
input pin. The INT is connected to the interrupt pin of the microprocessor unit. Whenever an
interrupt is noticed by the CPU, it generates signal
. Cascade Buffer
This function block stores the IDs of all 8259A are 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 master, the 8259A sends the ID of the interrupting slave
device onto the CAS0 –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.
(See section ‘‘Cascading the 8259A’’.
WORKING OF 8259
The 8259 accepts interrupt requests from any one of the 8 I/O lines (IR0 - IR7). Then it
ascertains the priority of the interrupt lines. Then it ascertains the priority of the interrupt
lines. Suppose, the received interrupt has higher priority than currently serviced, it interrupts
the microprocessor and after receiving the interrupt acknowledgement from microprocessor.
It provides a 3 byte CALL instruction. The sequence of steps that occur when an interrupt
request line of 8259 goes high is as follows.
□ The 8259 accepts the requests on IR0 - IR7 in IRR. Then it checks the contents of
IMR whether that request is masked or not.
□ The 8259, then checks ISR to know the interrupt levels that are being currently
serviced. After this 8259 sends a high INT to 8085 processor. Normally, it is the job of the
priority resolver to check the contents of IRR, IMR and ISR and decide whether to activate
INT output of 8259 or not.
□ Now 8085 processor responds by suspending the program flow at the end of the
current instruction and makes low.
□ On receiving, 8259 sends code for CALL to the microprocessor on D7-0 bus.
□ This code for CALL in IR register of 8259 causes the 8085 to issue two more signals.
When goes low the second time, 8259 places LSB of ISS address on the data bus. When goes
low the third time, 8259 places the MSB of ISS address ont he data bus.
□ Now, the microprocessor branches to the ISS after saving the contents of program
counter on the stack top.
□ After finishing the ISS, the control returns to the main program by popping the top of
stack to PC.
Programming 8259
The 8259 requires two types of command words namely, Initialization Command Words
(ICW) and Operational Command Words (OCW). The 8259 can be initialized with four
ICWs, the first two are essential and the other two are optional based on the modes being
used. These words must be issued in a sequence. Once the 8259 is initialized, the 8259 can
operate in various modes by using three different OCWs.
Introduction
It is always possible to generate accurate time delays using the microprocessor system by
using software loop programs. But that will waste the precious time of CPU. Hence INTEL
introduced the chips 8253/8254 which is a hardware solution for the problem of generating
accurate time delays. These chips can be used for applications such as a real-time clock,
event counter, a digit alone shot, a square wave generator and also as a complex wave form
generator.
Salient Features
8254 is an upgraded version of 8253 and they are pin-compatible.
8254 can operate with higher clock frequency ranging from DC to 8 MHz
and 10 MHz, whereas the 8253 can operate with clock frequency from DC to 2 MHz.
8254 includes a status read-back command that can latch the count and the status of
the counters. This command is not available in 8253.
8253 uses N-MOS technology where as 8254 uses H-MOS technology.
The chips are packaged in 24 pin DIP and requires a single +5V DC power supply.
Three identical 16 bit counters that can operate independently in any of the six modes
are available. The counters are down counters.
These chips are compatible with all INTEL and most of the other microprocessors.
To operate a counter, a 16 bit count is loaded in its register and on command beings to
decrement the count until it reaches 0. At the end of the count, it generates a pulse that can be
used to interrupt the microprocessor.
The counters can be programmed for either binary or BCD count.
The read-back command of 8254 allows the user to check the count value and current
status of the counter.
Read/Write Logic
The read/write logic accepts inputs from the system bus and in turn generates control signals
for overall device operation. It is enabled or disabled by so that no operation can occur to
change the function unless the device is selected by the system logic.
RD : A low on this pin informs the 8253 that the CPU is inputting data in the form of
counters value.
WR : It is an active low pin. A low on this pin informs the 8253 that the CPU is outputting
data in the form of mode information or loading counters.
A0,A1: These two lines are address lines used to select one of the three counters and the
control word register as shown in the table for mode selection.
CS(Chip Select): It is an active low pin. A low on this input enables 8253. No read or write
will occur unless the device is selected. The input has no effect on the actual operation of the
counters.
Table 4: Selection and function of 8253/54 Counters CONTROL WORD REGISTER:
• This register is selected when A0, A1 are at logic 1. It then accepts the information
from the data bus buffer and stores it in a register.
• The information stored in this register controls the operation MODE of each
counter, selection of binary or BCD counting and the loading of each count register.
• The control word register can only be written to into, but no read operation is
possible.
Counter 0, Counter 1, Counter 2
• These three functional blocks are identical in operation. Each counter consists of a
single 16 bit, pre-settable DOWN counter.
• The counter can operate in either binary or BCD and its input, gate and output are
configured by the selection of modes stored in the control word register.
• The counters are totally independent. The counter can be read by a simple READ
operation for event count applications.
Operational Description
• The complete functional operation of 8253 is programmed by the system software.
• A set of control words must be sent out by the CPU to initialize each counter of
8253/8254 with the desired MODE.
• Once programmed, the 8253 is ready to perform whatever timing tasks it is assigned
to perform.
The actual counting operation of each counter is totally independent and additional logic is
provided on-chip so that the usual problems associated with efficient monitoring and
management of external, asynchronous events or rates to the micro computer system have
been eliminated.
PROGRAMMING 8253/54
Each counter of 8253/54 is individually programmed by writing a control word into control
word register. The control word register is shown in Figure below. The different bits of this 8
bit register are either set or reset for the operation of the counters.
The various options are given below.
While using 8253/54 we must write the control word to initialize the counter to be used. For
every counter we use, the control word must be written and select the counter and set it up.
8253/54 can operate in six different modes. The modes of operation are explained below.
Mode 0 (Interrupt on Terminal Count)
• The output of the counter will be initially low after the mode set operation.
• After the count is loaded into the selected counter register the output will remain low
and the counter will count.
• When terminal count is reached, the output will go high and remain high until the
selected count register is reloaded with the mode or a new count is loaded.
Mode 1 (Programmable one shot)
• In this mode, the out signal is initially high. When the GATE is triggered, the OUT
goes low, and when count reaches 0, the OUT goes high again.
• Thus a one shot signal is generated due to the signal on the GATE.
Mode 2 (Rate Generator)
• It is a divide by N counter. In this mode, a pulse is generated that is equal to the clock
period at a given interval controlled by the count that is loaded.
• When the count is loaded, the OUT signal stays high until the count reaches 1, at this
point the OUT signal goes low for one clock period.
• Afterwards, the count is reloaded automatically and the cycle repeats, generating a
continuous string of pulses.
Mode 3 (Square-wave Generator)
• In this mode, when the count is loaded, the OUT signal is high. The count is then
determined by two with each clock cycle.
• When the count reach 0 the OUT signal goes low and the count is reloaded
automatically. As this is repeated continuously a square wave is generated on the OUT signal.
• The period of the square wave is controlled by the count value.