Unit 3 Microprocessor
Unit 3 Microprocessor
UNIT-III
MICROPROCESSOR
By: Mr. Madan Singh
UNIT III: 16-bit Microprocessors (8086) KEC-
Contents 502
• Architecture
• Pin Description
• Physical address, segmentation, memory organization
• Addressing modes
• Peripheral Devices:
• 8237 DMA Controller
• 8255 programmable peripheral interface
• 8253/8254programmable timer/counter
• 8259 programmable interrupt controller
• 8251 USART and RS232C.
8086 Features
• 16-bit data bus
• 20-bit address bus (220 = 1,048,576 = 1M)
•The address refers to a byte in memory.
•In the 8086, bytes at even addresses come in on the low half of the data bus (bits 0-7)
and bytes at odd addresses come in on the upper half of the data bus (bits 8-15).
•The 8086 can read a 16-bit word at an even address in one operation and at an odd
address in two operations.
•The least significant byte of a word on an 8086 family of microprocessor is at the
lower address.
8086 ARCHITECTURE
BLOCK DIAGRAM
• BIU:
BUS INTERFACE
UNIT
• EU:
EXECUTION UNIT
8086 Architecture
• The 8086 has two parts, the Bus Interface Unit (BIU) and the Execution
Unit (EU).
• The BIU fetches instructions, reads and writes data, and computes the 20-bit address.
• The EU decodes and executes the instructions using the 16-bit ALU.
• The BIU contains the following registers:
IP - the Instruction Pointer
CS - the Code Segment Register
DS - the Data Segment Register
SS - the Stack Segment Register
8086 Architecture
• The BIU fetches instructions using the CS and IP, written CS:IP, to contruct
the 20-bit address.
• Data is fetched using a segment register (usually the DS) and an effective
address (EA) computed by the EU depending on the addressing mode.
8086 ARCHITECTURE BLOCKS
•The AX, BX, CX, and DX registers can be considered as two 8-bit registers, a
High byte and a Low byte.
•This allows byte operations and compatibility with the previous generation of 8-bit
processors, the 8080 and 8085. 8085 source code could be translated in 8086 code
and assembled.
•The 8-bit registers are:
• AX --> AH,AL
• BX --> BH,BL
• CX --> CH,CL
• DX --> DH,DL
8086
Programmer’s
Model
Flag Register
Flag register
contains
information
reflecting the
current status of a
microprocessor.
It also contains
information which
controls the
operation of the
microprocessor.
8086 MICROPROCESSOR:
PIN DIAGRAM
• MINIMUM MODE
• MAXIMUM MODE
MIN and MAX Modes
(Why MIN and MAX modes?)
• Min mode signals can be directly decoded by memory and I/O circuits,
resulting in a system with minimal hardware requirements.
• Max mode systems are more complicated but has the new signals that allow
for bus grants (e.g. DMA), and the use of an 8087 coprocessor.
THE PINS OF MINIMUM MODE
• ALE: address latch enable (AD0 – AD7)
• DEN: data enable (connect/disc. buffer): It stands for Data Enable and is available at pin
26. It is used to enable Transreceiver 8286. The transreceiver is a device used to separate
data from the address/data bus.
• WR: write (writing indication)
• HOLD: Hold
• HDLA: Hold acknowledge
• INTA: Interrupt acknowledge
• IO/M: Input_output/ Memory
• DT/R: It stands for Data Transmit/Receive signal and is available at pin 27. It decides the
direction of data flow through the transreceiver. When it is high, data is transmitted out
and vice-a-versa.
THE PINS OF MAX
MODE
• The number of address lines in 8086 is 20, 8086 BIU will send 20-bit
address to access one of the 1MB memory locations.
• The four segment registers actually contain the upper 16 bits of the starting
addresses of the four memory segments of 64 KB each with which the
8086 is working at that instant of time.
• A segment is a logical unit of memory that may be up to 64 kilobytes long.
• Each segment is made up of contiguous memory locations.
• It is an independent, separately addressable unit.
PHYSICAL ADDRESS CALCULATION
• The 20-bit address of a byte is called its Physical Address.
• Logical address is in the form of:
Base Address : Offset
• Offset is the displacement of the memory location from the starting location
of the segment.
• The value of Data Segment Register (DS) is 2222 H.
• To convert this 16-bit address into 20-bit, the BIU appends 0H to the LSBs
of the address.
• After appending, the starting address of the Data Segment becomes 22220H.
PHYSICAL ADDRESS CALCULATION
• If the data at any location has a logical address specified as:
2222 H : 0016 H
• Then, the number 0016 H is the offset.
• 2222 H is the value of DS.
• To calculate the effective address of the memory, BIU uses the following
formula:
Effective Address = Starting Address of Segment + Offset
• To find the starting address of the segment, BIU appends the contents of
Segment Register with 0H.
• Then, it adds offset to it.
PHYSICAL ADDRESS CALCULATION
Advantages of the Segmentation
• It provides a powerful memory management mechanism.
• Data related or stack related operations can be performed in different
segments.
• Code related operation can be done in separate code segments.
• It allows to processes to easily share data.
• It allows to extend the address ability of the processor, i.e. segmentation
allows the use of 16-bit registers to give an addressing capability of 1
Megabytes. Without segmentation, it would require 20-bit registers.
• It is possible to enhance the memory size of code data or stack segments
beyond 64 KB by allotting more than one segment for each area.
ADDRESSING MODES
• The different ways in which a source operand is denoted in an instruction is known
as addressing modes. There are 8 different addressing modes in 8086 programming −
• IMMEDIATE
• REGISTER
• DIRECT
• REGISTER INDIRECT
• BASE
• INDEX
• BASE-INDEX
• BASE INDEXED WITH DISPLACEMENT
ADDRESSONG MODES…
• The DMA I/O technique provides direct access to the memory while the
microprocessor is temporarily disabled.
• Disk memory systems and video systems are often DMA-processed.
• Disk memory includes floppy, fixed, and optical disk storage. Video systems
include digital and analog monitors.
• Two control signals are used to request and acknowledge a direct memory access
(DMA) transfer in the microprocessor-based system.
• the HOLD pin is an input used to request a DMA action
• the HLDA pin is an output that acknowledges the DMA action
• Two control signals are used to request and acknowledge a direct memory access
(DMA) transfer in the microprocessor-based system.
BASIC DMA OPERATION
• DRQ0−DRQ3: These are the four individual channel DMA request inputs, which are
used by the peripheral devices for using DMA services. When the fixed priority
mode is selected, then DRQ0 has the highest priority and DRQ3 has the lowest
priority among them.
• DACKo − DACK3:These are the active-low DMA acknowledge lines, which updates
the requesting peripheral about the status of their request by the CPU. These lines
can also act as strobe lines for the requesting devices.
• Do − D7: These are bidirectional, data lines which are used to interface the system
bus with the internal data bus of DMA controller. In the Slave mode, it carries
8237 PIN DESCRIPTION…
• IOR: It is an active-low bidirectional tri-state input line, which is used by the CPU to read
internal registers of 8237 in the Slave mode. In the master mode, it is used to read data from
the peripheral devices during a memory write cycle.
• IOW: It is an active low bi-direction tri-state line, which is used to load the contents of the
data bus to the 8-bit mode register or upper/lower byte of a 16-bit DMA address register or
terminal count register. In the master mode, it is used to load the data to the peripheral devices
during DMA memory read cycle.
• CLK: It is a clock frequency signal which is required for the internal operation of 8237.
• RESET: This signal is used to RESET the DMA controller by disabling all the DMA channels.
8237 PIN DESCRIPTION
• Ao - A3
• These are the four least significant address lines. In the slave mode, they act as an input,
which selects 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 8237.
• CS
• It is an active-low chip select line. In the Slave mode, it enables the read/write operations
to/from 8257. In the master mode, it disables the read/write operations to/from 8237.
• A4 - A7
• These are the higher nibble of the lower byte address generated by DMA in the master
mode.
8237 PIN DESCRIPTION
• READY: It is an active-high asynchronous input signal, which makes DMA ready by
inserting wait states.
• HRQ: This signal is used to receive the hold request signal from the output device. In
the slave mode, it is connected with a DRQ input line 8253. In Master mode, it is
connected with HOLD input of the CPU.
• HLDA:It is the hold acknowledgement signal which indicates the DMA controller
that the bus has been granted to the requesting peripheral by the CPU when it is set to
1.
• MEMR:It is the low memory read signal, which is used to read the data from the
addressed memory locations during DMA read cycles.
• MEMW: It is the active-low three state signal which is used to write the data to the
addressed memory location during DMA write operation.
8237 PIN DESCRIPTION…
• ADSTB: This signal is used to convert the higher byte of the memory address
generated by the DMA controller into the latches.
• AEN: This signal is used to disable the address bus/data bus.
• TC: It stands for ‘Terminal Count’, which indicates the present DMA cycle to the
present peripheral devices.
• MARK: The mark will be activated after each 128 cycles or integral multiples of it
from the beginning. It indicates the current DMA cycle is the 128th cycle since the
previous MARK output to the selected peripheral device.
• Vcc: It is the power signal which is required for the operation of the circuit.
DMA CONTROLLER
SIGNAL DIAGRAM
DMA CONTROLLER
CONNECTION
SCHEME
DMA CONTROLLER CONNECTION SCHEME…
• BLOCK DIAGRAM
8255 PPI FEATURES
PORT A:
This is an 8-bit buffered I/O latch.
It can be programmed by mode 0 , mode 1, mode 2.
PORT B:
• This is an 8-bit port
• It can be programmed by mode 0 and mode 1.
PORT C:
• This is an 8-bit port
• It is splitted into two parts.
• It can be programmed by bit set/reset operation.
8255 PPI FEATURES…
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.
8255 PPI FEATURES…
• The internal data bus and Outer pins D0-D7 pins are connected in internally.
• PIN DIAGRAM
Function of pins:
• RESET: This is used to reset the device. That means clear control registers.
• PA0-PA7:It is the 8-bit bi-directional I/O pins used to send the data to
peripheral or to receive the data from peripheral.
• PB0-PB7: It is the 8-bit bi-directional I/O pins used to send the data to
peripheral or to receive the data from peripheral
• PC0-PC7:This is also 8-bit bidirectional I/O pins. These lines are divided
into two groups.
1. PC0 to PC3(Lower Groups)
2. PC4 to PC7 (Higher groups)
OPERATION MODES:
Port Address:
Since 8255 is memory mapped
I/O, suppose it is addressed at
8000H.
Then when Chip select is
enabled, then port addresses of
8255 will be
Port A- 8000H (A1=0, A0=0)
Port B- 8001H (A1=0, A2=1)
Port C- 8002H (A1=1, A2=0)
Control Register- 8003H
CONTROL WORD:
PROGRAM
MVI A,83H Load accumulator with the control word
STA 8003H Write word in the control register to initialize the ports
LDA 8001H Read switches at Port B
STA 8000H Display the reading at Port A
LDA 8002H Read switches at Port C
ANI 0FH Mask the upper four bits of Port C; these bits are not input data
RLC
RLC
RLC
RLC
STA 8002H Display data at Port 𝐶𝑈
HLT
WRITE A BSR CONTROL WORD TO SET BITS
PC7 AND PC0
WRITE A BSR CONTROL WORD TO SET BITS
PC7 AND PC0
I/O MODES:
• MODE 0 (Simple input/Output):
• MODE 1 (HANDSHAKE)
• MODE 2 (BIDIRECTIONAL)
8255 PPI I/O OPERATING MODES
• This mode allows bidirectional data transfer over a single 8-bit data bus
using handshake signals.
• This feature is possible only Group A
• Port A is working as 8-bit bidirectional port.
• PC3-PC7 is used for handshaking purpose.
• The data is sent by CPU through this port when the peripheral request it.
MODE 0 (Basic I/O):
• This mode provides simple input and output operations for each of the three
ports.
• No handshaking is required, data is simply written to or read from a specific
port.
• The basic features of this mode are:
• Two 8-bit ports and two 4-bit ports
• Any Port can be input or output
• Outputs are latched
• Input are not latched
MODE 1: (Input/output with Handshake)
• This mode provides a means for transferring I/O data to or from a specified port
in conjunction with strobes or “hand shaking” signals.
• In this mode, port A and port B use the lines on port C to generate or accept
these “hand shaking” signals.
• The basic features of this mode are:
• Two Groups (Group A and Group B).
• Each group contains one 8-bit port and one 4-bit control/data port.
• The 8-bit data port can be either input or output.
• Both inputs and outputs are latched.
• The 4-bit port is used for control and status of the 8-bit port.
Control signals for input configuration
• STB (Strobe Input).
• A “low” on this input loads data into the input latch.
• IBF (Input Buffer Full F/F)
• A “high” on this output indicates that the data has been loaded into the input latch.
• IBF is set by STB’ input being low and is reset by the rising edge of the RD’ input.
• INTR (Interrupt Request)
• A “high” on this output can be used to interrupt the CPU when and input device is requesting
service.
• INTR is set by the condition: STB is a “one”, IBF is a “one” and INTE is a “one”.
• It is reset by the falling edge of RD.
• This procedure allows an input device to request service from the CPU by simply strobing its
data into the port.
• INTE A: Controlled by bit set/reset of PC4.
• INTE B: Controlled by bit set/reset of PC2.
Control signals for input
configuration
Control signals for output configuration
• OBF - Output Buffer Full :
• The OBF’ output will go “low” to indicate that the CPU has written data out to be specified
port.
• The OBF’ will be set by the rising edge of the WR input and reset by ACK input being low.
• ACK – (Acknowledge Input):
• A “low” on this input informs the 82C55A that the data from Port A or Port B is ready to be
accepted.
• A response from the peripheral device indicating that it is ready to accept data
• INTR - (Interrupt Request):
• A “high” on this output can be used to interrupt the CPU when an output device has accepted
data transmitted by the CPU.
• INTR is set when ACK is a “one”, OBF is a “one” and INTE is a “one”.
• It is reset by the falling edge of WR.
• INTE A: Controlled by bit set/reset of PC6.
• INTE B: Controlled by bit set/reset of PC2.
Control signals for output
configuration
MODE 2: Bi-directional I/O data transfer:
• Interrupt Request Register: It stores all interrupt level that are requesting for
interrupt service.
• Interrupt Service Register: It stores interrupt level that are currently being execute.
• Interrupt Mask Register: It stores interrupt level that will be masked, by storing
the masking bits of interrupt level.
• Priority Resolver: It checks all three registers and set the priority of the interrupts.
Interrupt with the highest priority is set in the ISR register. It also reset the interrupt
level which is already been serviced in the IRR.
• Cascade Buffer: To increase number of interrupt pin, we can cascade more number
of pins, by using cascade buffer. When we are going to increase the interrupt
capability, CSA lines are used to control multiple interrupts.
8259 PIN DIAGRAM
• INTA’: It is termed as an active low-input pin. The 8259 receives the signal
from INTA* to the output of 8085. 8085 sends the three consecutive INTA*
signals, the 8259sends a 3-byte CALL instruction to the 8085 via D7-0 pins.
The two bytes termed as second and third bytes of the CALL instruction
contains the ISS address which depends on the IR input of 8259 that is going
to be serviced.
• CAS:2-0: These are cascaded lines. Used only when there are multiple 8259s
in the system. The interrupt control system might have a master 8259 and
maximum eight Slave 8259s.
• SP*/EN’: This stands for “slave program/enable buffer”. This pin serves dual
function. When it is used as EN* pin it provides an active low-output pin that
8259 COMMAND WORDS:
• The 8259A accepts two types of command words generated by the CPU:
• 1. Initialization Command Words (ICWs): Before normal operation can begin, each
8259A in the system must be brought to a starting pointed by a sequence of 2 to 4
bytes timed by WR pulses.
• 2. Operation Command Words (OCWs): These are the command words which
command the 8259A to operate in various interrupt modes. These modes are:
• a. Fully nested mode
• b. Rotating priority mode
• c. Special mask mode
• d. Polled mode
• The OCWs can be written into the 8259A anytime after initialization
COMMAND WORDS:
This is used to
load the high
order byte of the
interrupt vector
address of all the
interrupts.
ICW3
ICW3 is required
only if there is more
than one 8259 in the
system and if they are
cascaded.
An ICW3 operation
loads a slave register
in the 8259
Programmable
ICW4:
It specifies,
•Whether to use special fully
nested mode or non-special
fully nested mode.
•Whether to use buffered mode
or non buffered mode.
•Whether to use Automatic
EOI or Normal EOI.
•CPU used, 8086/8088 or 8085.
8259 COMMAND WORDS
• The process of sending data bit by bit sequentially, over a single channel between
sender and receiver is known as serial transmission of data.
• • It requires only one communication line rather than n lines to transmit data from
sender to receiver.
• • For correct data transmission, there has to be some form of synchronization
between transmitter and receiver.
• • Serial communication reduce the cost of an IC package by reducing the number of
pins used for communication between different IC’s, instead of using parallel
communication.
SERIAL COMMUNICATION…
• SIMPLEX
• HALF DUPLEX
• FULL DUPLEX
SYNCHRONOUS Vs ASYNCHORONOUS
• SYNCHRONOUS DATA TRANSFER:
• • Sender and receiver use the same clock signal
• • Supports high data transfer rate
• • Needs clock signal between the sender and the receiver
• • A master (or one of the senders) should provide the clock signal to all the
receivers in the synchronous data transfer.
• ASYNCHRONOUS DATA TRANSFER:
• • For asynchronous data transfer, there is no common clock signal between the
sender and receivers.
• • Sender provides a synchronization signal to the receiver before starting the
transfer of each message
SERIAL SYNCHORONOUS TRANSMISSION
• Synchronous Transmission is efficient, reliable and is used for transferring a large
amount of data.
• Communication is performed is based on a synchronization signal added to each bit
from the sending side.
• Synchronization between the source and target is required so that the source knows
where the new byte begins since there is no space between the data.
• It provides real-time communication between connected devices. Chat Rooms, Video
Conferencing, telephonic conversations, as well as face to face interactions, are some of
the examples of Synchronous Transmission
ASYNCHORONOUS TRANSMISSION
• In Asynchronous Transmission data flows as 1 byte or a character at a time.
• For asynchronous transmission, a start bit is used to identify the beginning of each character
and at least one stop bit is used to identify end of data character, this is known as bit
synchronization.
• Effectively, the sender and receiver are synchronized on a character by character basis.
• Asynchronous serial data communication is widely used for character-oriented transmissions,
while block-oriented data transfers use the synchronous method.
• In the asynchronous method, each character is placed between start and stop bits. This is
called framing.
8251 PIN DIAGRAM:
8251 PINOUT:
CS’ – Chip Select : When signal goes low, the 8251A is selected by the MPU for
communication.
C/D’ – Control/Data : When signal is high, the control or status register is addressed;
when it is low, data buffer is addressed. (Control register & status register are
differentiated by WR and RD signals)
WR’ : When signal is low, the MPU either writes in the control register or sends
output to the data buffer.
RD’ : When signal goes low, the MPU either reads a status from the status register
or accepts data from data buffer.
RESET : A high on this signal reset 8251A & forces it into the idle mode.
CLK : Clock input, usually connected to the system clock for communication with
8251 PINOUT…
• TxD-(Transmit Data):-This is an output line for transmitting serial bits out on the
falling edge of TxC, which transmitter clock.
• TxC-(Transmitter clock):-This input signal controls the rate at which the bits are
transmitted by the USART. In synchronous mode, the baud rate will be the same as
the frequency of TxC. In asynchronous mode, it is possible to select the baud rate
factor by mode instruction.
• TxRDY-Transmitter Ready: This is the output signal. When it is high, it indicates the
buffer register is empty and USART is ready to accept a byte. It can be used either to
interrupt the MPU or to indicate the status. This signal is reset when a data byte is
loaded into the buffer.
• TxE-Transmitter Empty: This is an output signal. Logic 1 on this indicates the
output register is empty after transmitting all the characters. This signal is reset when
8251 PINOUT…
• RxD-Receive Data: Bits are received serially on this line and converted into a
parallel byte in the receiver input register.
• RxC-Receiver clock: This is a clock signal that controls the rate at which bits are
received by the USART. In the asynchronous mode, the clock can be set to 1,16
or 64 times the baud.
• RxRDY-Receiver Ready: This is an output signal. It goes high when the USART
has a character in the buffer register and is ready to transfer into the MPU.
• This line can be used either to indicate the status or to interrupt the MPU. When
MPU reads a data character, RxRDY will be reset by the leading edge of RD
signal.
8251 PINOUT…
• Data Bus Buffer: D0-D7 : 8-bit data bus used to read or write status, command
word or data from or to the 8251A.
• Read/Write Control logic: Includes a control logic, six input signals & three
buffer registers:
• Data register
• Control register
• Status register.
• Control logic : Interfaces the chip with MPU, determines the functions of the chip
according to the control word in the control register & monitors the data flow.
DATA REGISTER
• Data register: Used as an input and output port when the C/D is
low
CONTROL REGISTER & STATUS REGISTER
Accepts serial data on the RxD pin and converts them to parallel data. It has two registers :
Receiver input register
Buffer register
When RxD goes low, the control logic assumes it is a start bit, waits for half bit time, and
samples the line again. If the line is still low, the input register accepts the following data,
and loads it into buffer register at the rate determined by the receiver clock.
RxRDY - Receiver Ready Output: Output signal, goes high when the USART has a
character in the buffer register & is ready to transfer it to the MPU.
RxD - Receive Data Input : Bits are received serially on this line & converted into a parallel
byte in the receiver input register.
RxC - Receiver Clock Input : Clock signal that controls the rate at which bits are received
by the USART.
RECEIVER SECTION
MODE INSTRUCTION FORMAT
COMMAND INSTRUCTION FORMAT
INTERFACING
• Each counter has 2 input pins, i.e. Clock & Gate, and 1 pin for “OUT” output.
• 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.
PIN DIAGRAM
CONTROL WORD
REGISTER AND
COUNTERS SELECTION
MODES OF OPERATION:
• This mode is similar to Mode 2 except the output remains low for half of
the timer period and high for the other half of the period.
Mode 4 − Software Triggered Mode
• In this mode, the output will remain high until the timer has counted to
zero, at which point the output will pulse low and then go high again.
• The count is latched when the GATE signal goes LOW.
• On the terminal count, the output goes low for one clock cycle then goes
HIGH. This low pulse can be used as a strobe.
MODE 5 : HARWARE TRIGGERED STROBE
• Allows user to check the count value, Programmed mode and the current
states of the OUT Pin.
PREVIOUS YEARS QUESTION PAPERS
THE END