Microprocessors 4
Microprocessors 4
Module-1(Evolution of microprocessors):
8085 microprocessor (-Basic Architecture only). 8086 microprocessor – Architecture and signals, Physical Memory organization,
Minimum and maximum mode of 8086 system and timings. Comparison of 8086 and 8088.Machine language Instruction format .
Module-2 (Addressing modes and instructions):
Addressing Modes of 8086. Instruction set – data copy /transfer instructions, arithmetic instructions, logical instructions, string
manipulation instructions, branch instructions, unconditional and conditional branch instruction, flag manipulation and
processor control instructions. Assembler Directives and operators. Assembly Language Programming with 8086.
Module- 3 (Stack and interrupts):
Stack structure of 8086, programming using stack- Interrupts - Types of Interrupts and Interrupt Service Routine- Handling
Interrupts in 8086- Interrupt programming. - Programmable Interrupt Controller - 8259, Architecture (Just mention the control
word, no need to memorize the control word)- Interfacing Memory with 8086.
Module- 4 (Interfacing chips):
Programmable Peripheral Input/output port 8255 - Architecture and modes of operation Programmable interval timer 8254-
Architecture and modes of operation- DMA controller 8257 Architecture (Just mention the control word, no need to memorize
the control word of 8254 and 8257).
Module- 5 (Microcontrollers):
8051 Architecture- Register Organization- Memory and I/O addressing- Interrupts and Stack- 8051 Addressing Modes- Instruction
Set- data transfer instructions, arithmetic instructions, logical instructions, Boolean instructions, control transfer instructions-
Simple programs.
MODULE 4
8255 – Programmable Peripheral Interface
• The Intel 8255A is a general purpose programmable I/O device designed for use with Intel microprocessors.
• It consists of three 8-bit bidirectional I/O ports (24 I/O lines) that can be configured to meet different system I/O needs.
• The three ports are designated as PORT A, PORT B and PORT C.
Ports of 8255
• Port A contains one 8-bit output latch/buffer and one 8-bit input buffer.
• Port B is same as PORT A.
• However, PORT C is split into two parts- PORT C lower (PC3-PC0) and PORT C upper (PC7-PC4) by the control word.
• The four ports – two 8-bit PORTs and two 4-bit PORTs are divided in two groups for programming purpose
Group A (PORT A and upper PORT C)
Group B (PORT B and lower PORT C)
Modes of 8255 – It works in two modes:
1.Bit set reset (BSR) mode
2.Input/output (I/O) mode
• To know in which mode the interface is working we need to know the value of Control word.
• Control word is a part of control register in 8255 which specify an I/O function for each port.
• If the most significant bit of control word or D7 is 1 then 8255 works in I/O mode else, if its value is 0 it works in BSR mode.
1. BSR Mode – When MSB of the control register is zero (0), 8255 works in Bit Set Reset mode.in this only PC bit are used for set
and reset.
2. I/O Mode – When MSB of the control register is one (1), 8255 works in Input-Output mode.it is further divided into three
categories.
3. Mode 0 – In this mode all three ports (PA, PB, PC) can work as simple input function or output function also in this mode there
is no interrupt handling capabilities.
4. Mode 1 – In this either port A or port B can work and port C bits are used as Handshake signal before actual data transmission
plus it has interrupt handling capabilities.
5. Mode 2 – In this only port A works
and port B can work either in Mode 0 or
Mode 1 and the 6 bits of port C are used as
Handshake signal plus it also has to
interrupt handling capability.
Format of control word 8255 - BSR
Mode
Format of control word 8255 - IO Mode
Operating Modes of 8255
8255A has three different operating modes −
• Mode 0 − In this mode, Port A and B is used as two 8-bit ports and Port C as two 4-bit ports. Each port can be programmed in
either input mode or output mode where outputs are latched and inputs are not latched. Ports do not have interrupt capability.
• Mode 1 − In this mode, Port A and B is used as 8-bit I/O ports. They can be configured as either input or output ports. Each port
uses three lines from port C as handshake signals. Inputs and outputs are latched.
• Mode 2 − In this mode, Port A can be configured as the bidirectional port and Port B either in Mode 0 or Mode 1. Port A uses
five signals from Port C as handshake signals for data transfer. The remaining three signals from Port C can be used either as
simple I/O or as handshake for port B
ARCHITECTURE OF 8255
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.
• Data Bus Buffer:
It is a tri-state 8-bit buffer used to interface the chip to the system data bus. Data is transmitted or received by the buffer upon
execution of input or output instructions by the CPU. Control words and status
information are also transferred through the data bus buffer.
•Read/Write and Logic Control:
The function of this block is to control the internal operation of the device and to
control the transfer of data and control or status words. It accepts inputs from the CPU
address and control buses and, in turn, issues command to both the control groups.
•CS (Chip Select):
A low on this input selects the chip and enables the communication between 8255A &
the CPU. It is connected to the decoded address, and A0 & A1 are connected to the
microprocessor address lines.
Their result depends on the following conditions
• RESET
This is an active high signal. It clears the control register and sets all ports in the input mode.
• RD (Read):
A low on this input enables the 8255A to send the data or status information to the CPU on the data bus.
• WR (Write):
A low on this input pin enables the CPU to write data or control words into the 8255A.
• A1, A0 Port Select:
These input signals, in conjunction with the RD and WR inputs, control the selection of one of the three ports or the control word
registers. They are normally connected to the least significant bits of the address bus (A0 and A1).
A1 A0 RD WR CS Result
Input Operation
0 0 0 1 0
PORT A → Data Bus
0 1 0 1 0 PORT B → Data Bus
1 0 0 1 0 PORT C → Data Bus
Output Operation
0 0 1 0 0
Data Bus → PORT A
0 1 1 0 0 Data Bus → PORT A
1 0 1 0 0 Data Bus → PORT B
1 1 1 0 0 Data Bus → PORT D
To communicate with peripherals through 8255 three steps are necessary:
1.Determine the addresses of Port A, B, C and Control register according to Chip Select Logic and the Address lines A0 and A1.
2.Write a control word in control register.
3.Write I/O instructions to communicate with peripherals through port A, B, C.
The common applications of 8255 are:
• Traffic light control
• Generating square wave
• Interfacing with DC motors and stepper motors
DMA Controller 8257
• The 8257, on behalf of the devices, requests the CPU for bus access using local bus request input i.e., HOLD in minimum mode.
• In maximum mode of the microprocessor RQ/GT pin is used as bus request input.
• On receiving the HLDA signal (in minimum mode) or RQ/GT signal (in maximum mode) from the CPU, the requesting devices
gets the access of the bus.
• It completes the required number of DMA cycles for the data transfer and then hands over the control of the bus back to the
CPU
Architecture of 8257
• The chip support four DMA
channels, i.e., four
peripheral devices can
independently request for
DMA data transfer through
these channels at a time
• Each of four channels of
8257 has a pair of two 16-bit
registers, viz. DMA address
register and terminal count
register.
• There are two common
registers for all the channels,
namely, mode set
register and status register.
• Thus, there are a total of
ten registers.
• The CPU selects one of
these ten registers using address lines A0-A3.
DMA Address Register
• Each DMA channel has one DMA 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
Terminal Count Register
• Each of the four DMA channels of 8257 has one terminal count
register (TC).
• This 16-bit register is used for ascertaining that the data transfer
through a DMA channel cease or stops after the required number of
DMA cycles.
• The low order 14-bits of the terminal count register are
initialised with the binary equivalent of the number of required
DMA cycles minus one.
• The bits 14 and 15 of this register indicate the type of the DMA operation.
Mode Set Register
• The function of the mode set register is to
enable the DMA channels individually and
also to set the various modes of operation
• The DMA channel should not be enabled till
the DMA address register and the terminal
count register contains valid information
Data Bus Buffer
• The 8-bit tristate, bidirectional buffer
interfaces the internal bus of 8257 with the external system bus under the control of various control signals
Read/Write Logic
• In the slave mode, the read/write logic accepts the I/O Read or I/O Write signals, decodes the Ao-A3 lines and either writes the
contents of the data bus to the addressed internal register or reads the contents of the selected register
• In master mode, the read/write logic generates the IOR and IOW signals to control the data flow to or from the selected
peripheral.
Control Unit
•The control logic controls the sequences of operations and generates the required control signals like AEN, ADSTB, MEMR,
MEMW, TC and MARK along with the address lines A4-A7, in master mode.
Priority Resolver
•The priority resolver resolves the priority of the four DMA channels depending upon whether normal priority or rotating
priority is programmed.
PIN DIAGRAM
Signal Description of
8257:
DRQ0-DRQ3
• These are the four
individual channel DMA
request inputs, used by
the
peripheral devices for
requesting the DMA
services.
• The DRQo has the
highest priority while
DRQ3 has the lowest
one, if the
fixed priority mode is
selected.
DACK0 - DACK3
• These are the active-
low DMA acknowledge
output lines which inform the requesting peripheral that the request has been honoured
Do-D7
• These are bidirectional, data lines used to interface the system bus with the internal data bus of 8257.
• These lines carry command words to 8257 and status word from 8257, in slave mode.
• When the 8257 is the bus master, it uses Do-D7 lines to send higher byte of the generated address to the latch
IOR
• This is an active-low bidirectional tristate line that acts as an input in the slave mode.
• In slave mode, this input signal is used by the CPU to read internal registers of 8257.
• In master mode, this signal is used to read data from a peripheral during a memory write cycle.
IOW
• This is an active low bidirectional tristate line.
• It acts as input in slave mode to load the contents of the data bus to the upper/lower byte of a 16-bit DMA address register or
terminal count register.
• In master mode, this signal is used to write data to a peripheral during a memory read cycle
CLK
• This is a clock frequency input required to derive basic system timings for the internal operation of 8257
RESET
• This active-high asynchronous input disables all the DMA channels by clearing the mode register and tri-states all the control
lines
A0-A3
• These are the four least significant address lines.
• In slave mode, they act as input which select one of the registers to be read or written.
• In the master mode, they are the four least significant memory address output lines generated by 8257.
A4-A7
• This is the higher nibble of the lower byte address generated by 8257 during the master mode of DMA operation.
READY
• This is an active-high asynchronous input used to stretch memory read and write cycles of 8257 by inserting wait states.
• This is used while interfacing slower peripherals
CS
• This is an active-low chip select line that enables the read/write operations from/to 8257, in slave mode.
• In the master mode, it is automatically disabled to prevent the chip from getting selected while performing the DMA operation
HRQ
• The hold request output requests the access of the system bus.
• In the non-cascaded 8257 systems, this is connected with HOLD pin of CPU
• In the cascade mode, this pin of a slave is connected with a DRQ input line of the master 8257, while that of the master is
connected with HOLD input of the CPU
HLDA
• The CPU drives this input to the DMA controller high, while granting the bus to the device.
• This pin is connected to the HLDA output of the CPU.
• This input, if high, indicates to the DMA controller that the bus has been granted to the requesting peripheral by the CPU.
MEMR
• This active –low memory read output is used to read data from the addressed memory locations during DMA read cycles.
MEMW
• This active-low output is used to write data to the addressed memory location during DMA write operation.
ADSTB
• This output from 8257 strobes the higher byte of the memory address generated by the DMA controller into the latches.
AEN
• This may be used to disable the system address and data bus
MARK
• The modulo 128-mark output indicates to the selected peripheral that the current DMA cycle is the 128th cycle since the
previous MARK output
• The mark will be activated after each 128 cycles or integral multiples of it from the beginning of the data block (the first DMA
cycle).
TC
• Terminal count output indicates to the currently selected peripherals that the present DMA cycle is the last for the previously
programmed data block.
Vcc • This is a +5v supply pin required for operation of the circuit.
GND • This is a return line for the supply (ground pin of the IC).
Read/Write Logic
• It includes 5 signals, i.e., RD, WR, CS, and the address
lines A0 & A1.
• In the peripheral I/O mode, the RD and WR signals are
connected to IOR and IOW, respectively. In the memory-
mapped I/O mode, these are connected to MEMR and
MEMW.
• Address lines A0 & A1 of the CPU are connected to lines A0 and A1 of the 8253/54, and CS is tied to a decoded address.
• The control word register and counters are selected according to the signals on lines A0 & A1.
Counters
• Each counter consists of a single, 16 bit-down counter, which can be operated in either binary or BCD.
• Its input and output is configured by the selection of modes stored in the control word register.
• The programmer can read the contents of any of the three counters without disturbing the actual count in process.
• Counters are programmed by writing a Control Word and then an initial count.
• GATE=1 enables counting, GATE=0 disables counting.