2.2) 8086
2.2) 8086
MICROCONTROLLERS (BECE204L)
DR. VIVEK RAJPOOT
ASSISTANT PROFESSOR SG-1
SCHOOL OF ELECTRONICS ENGINEERING (SENSE)
VELLORE INSTITUTE OF TECHNOLOGY, VELLORE
Generalized Block Diagram ✓ controls the computer
and performs all
ALU performs arithmetic and Communication through calculations.
logical operations on the data I/O Port/Bus
received from an input device ✓ ability to perform
or memory various operations
quickly
Pin Diagram
Architecture
MODULE 2: MICROPROCESSOR ARCHITECTURE AND INTERFACING:INTELx86
16 bit Microprocessor:8086
▪ Enhanced version of Intel 8085 microprocessor. It 8085 8086
was designed by Intel in 1978.
8 bit data bus, 16 bit address line 16 bit data bus, 20 bit address line
▪ 16-bit, N-channel, HMOS microprocessor. Where the 5 Flags and 64 KB memory capacity 9 Flags and 1 MB memory capacity
HMOS is used for "High-speed Metal Oxide
Semiconductor“
Does not support memory Supports memory segmentation,
▪ Built on a single semiconductor chip and packaged in segmentation, maximum or maximum or minimum mode &
a 40-pin IC package. The type of package is DIP (Dual minimum mode & pipelining pipelining
Inline Package) Accumulator based General Purpose Registers based
▪ Consists of a powerful instruction set, which provides Low Cost High Cost
operation like division and multiplication very quickly.
Data Registers
Pointer Registers
Segment
Index Registers Registers
Instruction Pointer
16 bit register. Holds instruction codes of a program and base address of memory segment
16 bit register. Data, variables and constants given in the program and logical address of memory segment are held
❑ 16 bit register. Holds addresses and data of subroutines. Holds the contents of registers and memory locations
given in PUSH instruction and offset address of memory segment
16 bit register. Holds the destination addresses of some data of certain string instructions and starting address of memory
segment
▪ Index Register:Stack Pointer (SP),Base Pointer (BP),Source Index (SI),Destination Index (DI).Hold offset or logical address within a
segment.16 bit
▪ ALU: It handles all arithmetic and logical operations. Such as addition, subtraction, multiplication, division, AND, OR, NOT operations
▪ Flag Register: 16 bit register which exactly behaves like a flip-flop, means it changes states according to the result stored in the
accumulator. It has 9 flags and they are divided into 2 groups i.e. conditional and control flags
8086 Pin Diagram ✓ BHE/S7 (Output): Bus High Enable/Status.
During T1, it is low. It enables the data onto the
most significant half of data bus, D8-D15. 8-bit
➢ AD0-AD15:Low order address device connected to upper half of the data bus
bus. They are multiplexed with use BHE signal. It is multiplexed with status
data. When used to transmit signal S7. S7 signal is available during T3 and T4.
memory address, the symbol A ✓ RD (Read): For read operation. It is an output
is used instead of AD signal. It is active when LOW.
✓ Ready (Input): The addressed memory or I/O
sends acknowledgment through this pin. When
➢ A16-A19 (Output): High
HIGH, it denotes that the peripheral is ready to
order address lines. These
transfer data.
are multiplexed with status
✓ RESET (Input): System reset. The signal is active
signals
HIGH.
➢ A16/S3, A17/S4: A16 and A17 ✓ CLK (input): Clock 5, 8 or 10 MHz
are multiplexed with segment
identifier signals S3 and S4. ❑ INTR: Interrupt Request.
❑ NMI (Input): Non-maskable interrupt request.
➢ A18/S5: A18 is multiplexed with ❑ TEST (Input): Wait for test control. When LOW the
interrupt status S5. microprocessor continues execution otherwise
waits.
➢ A19/S6: A19 is multiplexed with ❑ VCC: Power supply +5V dc.
status signal S6 ❑ GND: Ground
▪ 8086 microprocessors have 8 addressing modes. Of these, two addressing modes have been provided for instructions which operate on register
or immediate data
▪ Register Addressing: Operand is placed in one of the 16-bit or 8-bit general purpose registers (Source). Ex. MOV AX, CX, ADD CX, DX
▪ Immediate Addressing: Operand is specified in the instruction itself. Ex. MOV AL, 35H
Effective Address (Offset) = [BX or BP] + [SI or DI] + 8-bit or 16-bit displacement
Ex. MOV AX, [BX + SI + 05]; 8-bit displacement
Address Addressing Modes in 8086
▪ These indicates the branch address in CALL and JUMP Instructions. Used for Control Transfer Instructions
Addressing Mode
Intersegment
Intrasegment
Direct Indirect
Direct Indirect
Memory Segmentation in 8086
▪ Process in which the main memory of the computer is logically divided into different segments and each segment has its own base
address
▪ To enhance the speed of execution of the computer system, so that the processor is able to fetch and execute the data from the
memory easily and fast.
▪ BIU contains four 16 bit special purpose registers called as Segment Registers
▪ Code segment register (CS): Used for addressing memory location in the code segment of the memory, where the executable
program is stored.
▪ Data segment register (DS): Points to the data segment of the memory where the data is stored.
▪ Extra Segment Register (ES): Also refers to a segment in the memory which is another data segment in the memory.
▪ Stack Segment Register (SS): Used for addressing stack segment of the memory. The stack segment is that segment of memory
which is used to store stack data.
▪ To enhance the speed of execution of the computer system, so that the processor is able to fetch and execute the data from the
memory easily and fast.
▪ BIU sends 20bit address, so as to access one of the 1MB memory locations
▪ 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. May be up to 64 kilobytes long
▪ 8086 does not work the whole 1MB memory at any given time. However, it works only with four 64KB segments within the whole
1MB memory.
▪ Starting address will always be changing. It will not be fixed.
Memory Segmentation in 8086
Types of Segmentation
➢ Overlapping Segment – A segment starts at a particular address and its maximum size can go up to 64kilobytes. But if another
segment starts along with this 64kilobytes location of the first segment, then the two are said to be Overlapping Segment.
➢ Non-Overlapped Segment – A segment starts at a particular address and its maximum size can go up to 64kilobytes. But if another
segment starts before this 64kilobytes location of the first segment, then the two segments are said to be Non-Overlapped Segment
Rules of Segmentation
➢ The starting address of a segment should be such that it can be evenly divided by 16.
➢ Minimum size of a segment can be 16 bytes and the maximum can be 64 kB
Advantages of 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
8086 Instruction Format
The opcode/addressing mode byte(s) may be followed by :
❑ No additional byte
❑ Two byte EA (For direct addressing only).
❑ One or two byte displacement
❑ One or two byte immediate operand
❑ One or two byte displacement followed by a one or two byt
immediate operand
❑ Two byte displacement and a two byte segment address (for direc
intersegment addressing only)
Intel 8255
▪ It has two versions, namely the Intel 8255A and Intel 8255A-5. General
descriptions for both are same but there exists some differences in electrical
characteristics
▪ It has three 8-bit ports, namely Port A, Port B and Port C.
▪ Port C has been further divided into two 4-bit ports, port C upper and Port C
lower. Thus a total of 4-ports are available, two 8-bit ports and two 4-bit ports.
▪ Each port can be programmed either as an input port or an output port.
8255 Architecture
Operating Modes of 8255
▪ Mode 0 - Simple Input/output: The 8255 has two 8-bit ports (Port A and Port B) and two 4-bit ports (Port Cupper and Port Clower). In Mode 0
operation, a port can be operated as a simple input or output port. Each of the 4 ports of 8255 can be programmed to be either an input
or output port.
▪ Mode 1-Strobed Input/output: Mode 1 is strobed input/output mode of operation. The Port A and Port B both are designed to operate in
this mode of operation. When Port A and Port B are programmed in Mode 1, six pins of Port C are used for their control.
▪ Mode 2 -Bidirectional Port: Mode 2 is strobed bidirectional mode of operation. In this mode Port A can be programmed to operate as a
bidirectional port. The mode 2 operation is only for Port A. When Port A is programmed in Mode 2, the port B can be used either Mode 1
or Mode 0 Operates on a single 5 Vd.c. supply Control Signals
▪ CS (Chip Select): It is a chip select signal. The LOW status of this
signal enables communication between the CPU and 8255.
PA0 - PA7 :8 ▪ RD (READ): When RD goes LOW the 8255 sends out data or status
Pins of port A information to the CPU on the data bus. In other words it allows the
PB0 - PB7 :8 CPU to read data from the input port of 8255.
pins of port B ▪ WR (Write): When WR goes LOW the CPU writes data or control
word into 8255. The CPU writes data into the output port of 8255
PC0 - PC3 :4
and the control word into the control word register.
pins of port ▪ RESET: RESET is an active high signal. It clears the control register
Clower PC4 - and sets all ports in the input mode.
PC7 :4 pins of ▪ A0 and A1: The selection of input port and control word register is
Port Cupper done using A0 and A1 in conjunction with RD and WR. A0 and A1
are normally connected to the least significant bits of the address
bus
8255 Pin Diagram
1st Unit
2nd Unit
Programmable Timer Controller
Used in real time application for timing and counting function such as BCD/binary counting, generation of accurate time delay,
generation of square wave of desired frequency, rate generation, hardware/software triggered strobe signal, one shot signal of
desired width etc
Intel 8253 and 8254:Both are pin to pin compatible and operate in six modes
▪ Mode 0: Interrupt on terminal count
▪ Mode 1: Programmable one-shot
▪ Mode 2: Rate generator
▪ Mode 3: Square wave generator
▪ Mode 4: Software triggered mode
▪ Mode 5: Hardware triggered mode
Note: The 8254 is compatible to 8086, 8088, 8085 and most other
microprocessors
8254 Architecture
8254 Pin Diagram
❑ RD (Read): When this pin is LOW the CPU reads data.
❑ ¯WR: (Write): When this is low, the CPU outputs data in the form of
mode information or loading of counters.
❑ A0, A1: These pins are connected to the address bus. These are used to
select one of three counters. These are also used to address the control
word registers for mode selection.
❑ CS: Chip Select.
❑ D0 - D7: Bidirectional data bus.
❑ CLK0, CLK1 and CLK2 are clock for Counter 0, Counter 1 and Counter 2
respectively.
❑ GATE0, GATE1 and GATE2 are gate terminals of Counter 0, Counter 1 and
Counter 2 respectively.
❑ OUT0, OUT1 and OUT2 are output terminals of Counter 0, Counter 1 and
Counter 2 respectively.
❑ The 8254 contains a data buffer, read/write logic and control word
register as described below:
❑ Data Bus Buffer: This buffer is within 8254. It is a 3-state, bidirectional, 8-
bit buffer. It is used to interface 8254 to the system data bus through D0 -
D7 lines.
❑ Read/Write logic: The 8254 contains a read/write logic which accepts
input from the system bus and then generates control signals for the
operation
❑ Counter Word Register: When the pins A0, A1 are 11, the control word register is
selected.
8254 Operational Modes
❑ The bits D7 and D6 of the control word are to select one of the 3 counters. D5 and D4 are for loading/reading the count. D3,
D2 and D1 are for the selection of operating mode of the selected counter.
❑ These are six modes of operation for each counter of 8254. The six modes of operation are: MODE 0, MODE 1, MODE 2,
MODE 3, MODE 4 and MODE 5. The bit D0 is for the selection of binary or BCD counting.
▪ Used for the generation of accurate time delay under software control.
▪ One of the counters of 8253 is initialized and loaded with suitable count for the desired time delay.
▪ When counting is finished the counter interrupts the CPU. On interruption the microprocessor performs the required task
which is to be performed after the desired time delay.
▪ For MODE 0 operation GATE is kept high. While counting is going on the counter output OUT remains LOW. When the
terminal count is reached i.e. count reaches 0, the output becomes HIGH until the count is reloaded or new count is loaded.
▪ When the count is reloaded or OUT becomes LOW and the counter starts its counting operation again.
▪ In MODE 3 the counter acts as a square wave generator. After mode set operation the counter is loaded by a count of value N.
▪ For MODE 3 operation GATE is kept HIGH.
▪ For even values of N the output remains HIGH for N/2 clock pulses abd then goes LOW for next N/2 clock pulses
MODE 5 : Hardware Triggered Strobe
MODE 4 : Software Triggered Strobe
▪ In this mode of operation GATE input acts as a trigger.
▪ In MODE 4 operation the output of the counter becomes initially
▪ After the mode is set, the output becomes initially HIGH.
HIGH after the mode is set.
▪ A count value of N is loaded into the counter.
▪ GATE is kept HIGH for this mode of operation. The counter begins
▪ Following a LOW to HIGH transition of the GATE input the
counting immediately after the count is loaded into the count
counter starts decrementing the count.
register.
▪ The counting begins at the first negative edge of the clock
▪ When the counter reaches terminal count (i.e. counter content = 0)
after the rising edge of the GATE input.
the output goes LOW for one clock period, then it returns to HIGH.
▪ On terminal count the output goes LOW for one clock
▪ The output signal may be used as strobe.
period, and then it goes HIGH again.
▪ This mode of operation is referred to as a software triggered
▪ As the LOW to HIGH transition of the GATE input causes
strobe because the generation of the strobe signal is triggered by
triggering, this mode is referred to as hardware triggered
loading the count into the count register.
strobe.
Memory Interfacing
To interface the memory with 8086, we need the system bus and the control signals for memory read and write operations
Block Diagram
THANK YOU