8255 Interfacing With Pin Daigram
8255 Interfacing With Pin Daigram
Unit-III
8255 PPI Architecture
8255 Internal Architecture
Operation of Different 8255 Modes
Control Word of 8255 PPI
BSR Mode Control Word
Working Modes of 8255
The Intel 82C55A is a general purpose programmable I/O device which may be used
with many different microprocessors.
There are 24 I/O pins which may be individually programmed in 2 groups of 12 and
used in 3major modes of operation.
The high performance and industry standard configuration of the 82C55A make it
compatible with the 8086.
This three-state bi-directional 8-bit buffer is used to interface the 82C55A to the system data
bus. Data is transmitted or received by the buffer upon execution of input or output
instructions by the CPU. Control word and status information are also transferred through the
data bus buffer.
The function of this block is to manage all of the internal and external transfers of both Data
and Control or Status words. It accepts inputs from the CPU Address and Control busses and
in turn, issues commands to both of the Control Groups.
These input signals, in conjunction with the RD and WR inputs, control the selection of one
of the three ports or the control word register. They are normally connected to the least
significant bits of the address bus (A1andA2).
(CS)Chip Select: A “low” on this input pin enables the communication between the 82C55A
and the CPU.
(RD) Read : A “low” on this input pin enables 82C55A to send the data or status information
to the CPU on the data bus. In essence, it allows the CPU to “read from” the 82C55A.
(WR) Write : A “low” on this input pin enables the CPU to write data or control words into
the 82C55A.
(RESET) Reset: A “high” on this input initializes the control register to 9Bh and all ports
(A, B, C)are set to the input mode.
Cathode is connected through a resistor to GND & the Anode is connected to the
Microprocessor pin as shown in Fig.
When the Port Pin is HIGH, the LED is ON &
When the Port Pin is LOW the LED is turned OFF.
5
MOV AL,80
MOV DX,FFE6
OUT DX,AL
GO: MOV AL,00
MOV DX,FFE0
OUT DX,AL
CALL DELAY
MOV AL,FF
OUT DX,AL
CALL DELAY
JMP GO
Signals in the real world are analog: light, sound, temperature, pressure, acceleration or other
phenomenon.
Hence, real-world signals must be converted into digital, using a circuit called ADC (Analog-
to-Digital Converter), before they can be manipulated by digital equipment.
• When you scan a picture with a scanner what the scanner is doing is an analog-to-
digital conversion: it is taking the analog information provided by the picture (light)
and converting into digital.
• When you record your voice on your computer, you are using an analog-to-digital
converter to convert your voice, which is analog, into digital information.
Microprocessor Only Understand Digital Signal, So Real World Analog Signal should
be Converted Into Digital to Process It By Microprocessor
8 bit ADC, which means we will get digital output 0 to 255. i.e. When the input is 0V, the
digital output will be 0V & when input is 5V (and Vref=5V), we will get the highest digital
output corresponding to 256 steps, which is 5V. ADC has 256 steps and
Timing Diagram
8
Conversion Table:
9
DAC Interfacing:
It convert digital pulses into analog signals. Two circuits used are (1. Binary weighted R/2R
ladder network. The vast majority of integrated circuit DACs including MC1408(DAC0808)
use R/2R method because it can achieve a much higher degree of precision. The number of
bits in the digital word is called it’s precision and there are8,10 and 12 bits DACs. The
number of discrete output voltage levels is 2n , where n is the number of bits in the input data.
In DAC0808 (MC1408), the digital inputs are converted to current IOUT and by connecting a
resistor to the IOUT pin, a voltage output is obtained. The total current provided by the IOUT pin
is a function of the binary numbers at the D0 to D7 inputs of the DAC0808 and the Irefcurrent
and it is given by
A stepper motor moves through a small angle when a pulse is applied to its winding. It is
used in disk drive, dot matrix printers, and robotics for position control.
A stepper motor commonly has a permanent magnet rotor surrounded by a stator. There is
also stepper motor called variable reluctance stepper motor which does not have a permanent
magnet rotor.
Controlling Types:
There are two types of controlling sequence for unipolar stepper motor:
Half Step Sequence.
Full Step Sequence.
Full Sequence:
Half Sequence:
Clockwise Rotation,
Anti-Clockwise Rotation
Here two coils are energized at the same time and motor shaft rotates. The order in which
coils has to be energized is given below.
12
Drivers
Stepper motor Interfacing needs a Driver Circuit
(Rotation in clockwise)
(Rotation in anticlockwise)
Features:
1. Control logic
2. Read Write logic
3. Data bus buffer
4. Interrupt Request Register (IRR)
5. In-Service Register (ISR)
6. Interrupt Mask Register (IMR)
7. Priority Resolver (PR)
8. Cascade buffer.
15
The data bus and its buffer are used for the following activities.
1. The processor sends control word to data bus buffer through D0-D7.
2. The processor read status word from data bus buffer through D0-D7.
3. From the data bus buffer the 8259 send type number (in case of 8086) or the call opcode
and address (in case of 8085) through D0-D7 to the processor.
The processor uses the RD (low), WR (low) and A0 to read or write 8259
• The 8259 is selected by CS (low).
• The IRR has eight input lines (IR0-IR7) for interrupts.
• When these lines go high, the request is stored in IRR.
• It registers a request only if the interrupt is unmasked.
• Normally IR0 has highest priority and IR7 has the lowest priority.
• The priorities of the interrupt request input are also programmable.
First the 8259 should be programmed by sending Initialization Command Word (ICW) and
Operational Command Word (OCW).
These command words will inform 8259 about the following,
• * Type of interrupt signal (Level triggered / Edge triggered).
• Type of processor (8085/8086).
• * Call address and its interval (4 or 8)
• * Masking of interrupts.
• * Priority of interrupts.
• * Type of end of interrupts
• The interrupt mask register (IMR) stores the masking bits of the interrupt lines to be
masked. The relevant information is send by the processor through OCW.
The in-service register keeps track of which interrupt is currently being serviced.
• The priority resolver examines the interrupt request, mask and in-service registers and
determines whether INT signal should be sent to the processor or not.
• The cascade buffer/comparator is used to expand the interrupts of 8259.
• In cascade connection one 8259 will be directly interrupting 8086 and it is called
master 8259.
• To each interrupt request input of master 8259 (IR0-IR7), one slave 8259 can be
connected. The 8259s interrupting the master 8259 are called slave 8259s.
• Each 8259 has its own addresses so that each 8259 can be programmed
independently by sending command words and independently the status bytes can be
read from it.
• The cascade pins (CAS0, CAS1 and CAS2) from the master are connected to the
corresponding pins of the slave.
• For the slave 8259, the SP (low) / EN (low) pin is tied low to let the device know that
it is a slave.
• The SP (low) / EN (low) pin can be used as input or output signal.
• In non-buffered mode it is used as input signal and tied to logic-I in master 8259 and
logic-0 in slave 8259.
• In buffered mode it is used as output signal to disable the data buffers while data is
transferred from 8259A to the CPU.
16
Features of 8257
• It has four channels which can be used over four I/O devices.
• Each channel has 16-bit address and 14-bit counter.
17
8257 Architecture
There are two common registers for all the channels, namely,
• Mode Set Register
• Status Register.
• Thus there are a total of ten registers.
• Address Register: The function of this register is to store the address of the starting
memory location, which will be accessed by the DMA channel.
• The mode set register is used for programming the 8257 as per the requirements of
the system.
18
• The status register: The lower order 4-bits of this register contain the terminal count
status for the four individual channels.
• Terminal Count Register: How many number of DMA cycles transferred.
• The TC pin is activated when the 14-bit content of the terminal count register of the
selected channel becomes equal to zero.
• Register selection
Description of pins:
• D0-D7:
• it is a bidirectional ,tri state ,Buffered ,Multiplexed data (D0-D7)and (A8-A15).
• In the slave mode it is a bidirectional (Data is moving).
• In the Master mode it is a unidirectional (Address is moving).
• IOR: It is active low ,tristate ,buffered ,Bidirectional lines.
• In the slave mode it function as a input line. IOR signal is generated by
microprocessor to read the contents 8257 registers.
• In the master mode it function as a output line. IOR signal is generated by 8257
during read cycle
• IOW:
• It is active low ,tristate ,buffered ,Bidirectional control lines.
• In the slave mode it function as a input line. IOW signal is generated by
microprocessor to write the contents 8257 registers.
• In the master mode it function as a output line. IOW signal is generated by 8257
during write cycle
• CLK:
• It is the input line ,connected with TTL clock generator.
• This signal is ignored in slave mode.
• RESET:
• Used to clear mode set registers and status registers
19
• A0-A3:
• These are the tristate, buffer, bidirectional address lines.
• In slave mode ,these lines are used as address inputs lines and internally decoded to
access the internal registers.
• In master mode, these lines are used as address outputs lines,A0-A3 bits of memory
address on the lines.
• CS:
• It is active low, Chip select input line.
• In the slave mode, it is used to select the chip.
• In the master mode, it is ignored.
• A4-A7:
• These are the tristate, buffer, output address lines.
• In slave mode ,these lines are used as address outputs lines.
• In master mode, these lines are used as address outputs lines,A0-A3 bits of memory
address on the lines.
• READY:
• It is a asynchronous input line.
• In master mode,
• When ready is high it is received the signal.
• When ready is low, it adds wait state between S1 and S3
• In slave mode ,this signal is ignored.
• HRQ:
• It is used to receiving the hold request signal from the output device.
• HLDA:
• It is acknowledgment signal from microprocessor.
• MEMR:
• It is active low ,tristate ,Buffered control output line.
• In slave mode, it is tristated.
• In master mode ,it activated during DMA read cycle.
• MEMW:
• It is active low ,tristate ,Buffered control input line.
• In slave mode, it is tristated.
• In master mode ,it activated during DMA write cycle.
• AEN (Address enable):
• It is a control output line.
• In master mode ,it is high
• In slave mode ,it is low
• Used it isolate the system address ,data ,and control lines.
• ADSTB: (Address Strobe)
• It is a control output line.
• Used to split data and address line.
• It is working in master mode only.
• In slave mode it is ignore.
• TC (Terminal Count):
• It is a status of output line.
• It is activated in master mode only.
• It is high ,it selected the peripheral.
• It is low ,it free and looking for a new peripheral.
•
20
• MARK:
• It is a modulo 128 MARK output line.
• It is activated in master mode only.
• It goes high ,after transferring every 128 bytes of data block.
• DRQ0-DRQ3(DMA Request):
• These are the asynchronous peripheral request input signal.
• The request signals is generated by external peripheral device.
• DACK0-DACK3:
• These are the active low DMA acknowledge output lines.
• Low level indicate that ,peripheral is selected for giving the information (DMA
cycle).
• In master mode it is used for chip select.
DATA BUS BUFFER:
• It contain tristate ,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 lines
(Unidirectional).
READ/CONTROL LOGIC:
• It control all internal Read/Write operation.
• Slave mode ,it accepts address bits and control signal from microprocessor.
• Master mode ,it generate address bits and control signal.
Control logic block:
• It contains ,
1. Control logic
2. Mode set register and
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 increments 16 bit address and decrement 14 bit counter registers.
• It activate a HRQ signal on DMA channel Request.
• Slave ,mode it is disabled.
Application of DMA Controller: