0% found this document useful (0 votes)
257 views

Block Diagram of Digital Computer:: Microprocessor

The document discusses the basic components of a microprocessor-based computer system. It describes: 1) The typical components of a computer system including input, processing, storage, control, and output. 2) Key concepts like bits, bytes, words, and how an ALU performs arithmetic and logic operations on words of data. 3) That a microprocessor is the central processing unit of a microcomputer and must interface with peripheral devices. 4) The roles of memory components like ROM, RAM, and registers in storing instructions and data for processing.

Uploaded by

Robotrix
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
257 views

Block Diagram of Digital Computer:: Microprocessor

The document discusses the basic components of a microprocessor-based computer system. It describes: 1) The typical components of a computer system including input, processing, storage, control, and output. 2) Key concepts like bits, bytes, words, and how an ALU performs arithmetic and logic operations on words of data. 3) That a microprocessor is the central processing unit of a microcomputer and must interface with peripheral devices. 4) The roles of memory components like ROM, RAM, and registers in storing instructions and data for processing.

Uploaded by

Robotrix
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Microprocessor

Block Diagram of digital computer:


Memory

Input ALU Output

CU

Basic system of computer:


 Input
 processing
 storage
 control
 output

Bit: A bit is the abbreviation for the term binary digit. A binary digit can have only
two values represented by the symbols 0 & 1.

Bit Size: the bit size of microprocessor refers to the number of bits that can be
processed simultaneously by the basic arithmetic circuit.

Word: A number of bits taken as a group in this manner called a word.

ALU: An ALU is a digital circuit that performs arithmetic & logic operation on
two n (n=4,8,16,32,64) bit digit words. Typical operations performed by the ALU are
addition, subtraction, ANDing, ORing, & comparison of two n-bit words.

Microprocessor: A microprocessor is the central processing unit of a micro-


computer & normally must be augmented with peripheral support device in order to
function. The CPU contains ALU Control unit or register.

1
Address: An address is a pattern of 0’s & 1’s that represent a specific location in
memory or a particular I/O device. Typical 8-bit microprocessor has a 16 address line.

MD. Arshad Ali , (TE-07049)


Microprocessor

ROM: Read only memory (ROM) is storage medium for the groups of bit called
words & its content can not normally be altered once programmed.
A typical ROM is fabricated on an LSI (large scale integration). A ROM is a Non-
Volatile. Which means that’s contents are retained in the event of a loss of power to the
ROM chip. ROMs are used to store instructions or data tables that must always be
available to the microprocessor.

RAM: Random access memory (RAM) is a storage device whose content not
only be read but also dynamically altered at specific address. A RAM is a volatile
memory.
Which means that’s contents is loss in the event of a power failure. A RAM is
normally used as scratchpad memory for the storage of temporary data & intermediate
results as well as programs that can be reloaded from a backup non-volatile source.

Register: A register can be considered on volatile storage for a number of bits.

Memory or RAM

Cache memory

Register Register
ALU
Register Register

BUS: The term bus refers a number of conductors organized to provide a means
of communication. The microcomputer contains three Buses which carry all the address,
data & control information. These Buses connect the CPU to each of the ROM, RAM &
I/O elements.
Types of BUS –
Memory

i. Address BUS BUS


ii.
iii.
Data BUS
Control BUS
CPU
2
Address Bus:
MD. Arshad Ali , (TE-07049)
Microprocessor

In this Bus information transfer takes place in only on direction from the
microprocessor to the memory or I/O elements. This is called a unidirectional Bus.
The address bits to memory or external device are sent out on the address bus.
For 8- bit microprocessors, this Bus is typically 16 bit long. A memory location or an I/O
element can be represented by each one of these address. For an 8-bit data word can
be stored in address 200016.

Data Bus:

In this Bus, data can flow in both directions to or from the microprocessor.
Therefore this is a bi-directional bus. In some microprocessor the data pins are used to
send other information such as address bits in addition to data.

Control Bus:

This Bus consists of a number of signals that are used to synchronize the
operation of the individual microcomputer elements.
The microprocessor sends some of these control signals to the other elements to
indicate the type of operation being performed. Each microcomputer has a unique set
of control signals.

Instruction Set:
The instruction set of a microprocessor is the list of commands that
microprocessor is designed to execute. Example – ADD, SUB, STORE, AND, OR.

Clock:
A micro – computer requires synchronization among its components & this is
provided by the clock or timing circuit. The signals provided by the clock circuits are
either single phase or multiphase.
A2B2 A1B1 A0B0
Cin
C3 C2 C1
FA FA FA

Y Y Y
CLK
3
Language: Expression of medium which the computer can be clearly understands
what to do by user.

MD. Arshad Ali , (TE-07049)


Microprocessor

I. M/C Language (0, 1)


II. Assembly Language
III. High level Language

What is Compiler & Interpreter?

Compiler:
It is a program translator that translates the instruction of a higher level
language to machine language (Binary Code).It is called compiler because it compiles
machine language instructions for every program instructions of higher language. While
compiler scans the entire program first & then translates it into machine language
(Binary Code).

Interpreter:

An Interpreter is another type of program translator used for translating higher


level language into machine language (Binary Code).
It takes one statement of higher level languages, translates it into machine
language & immediately executes it. Translation & execution are carried out for each
statement. That means Interpreter translates the program line by line. Thus compiled
machine language program runs much faster than an interpreted program.

Micro computer Architecture:


Address BUS
Control Bus
Data BUS

Microprocessor (CPU)
RAM ROM I/O

Memory unit

Fig: A Block Diagram of a Micro computer


4
Central processing unit:

MD. Arshad Ali , (TE-07049)


Microprocessor

The CPU executes all the instructions & performs arithmetic & logic operation on
data. The CPU of the micro-computer is called the micro processor. The MOS
microprocessor is typically a signal LSI chip that contents all of the control, Arithmetic,
& Logic circuits of the microcomputer.

Memory unit:

Memory unit store both data & instruction.


The memory section typically contains ROM & RAM chips. The Rom can only be
read & is non – volatile. That is it retains its content when the power is turned off. A
ROM is used to store instructions & data that don’t change. The RAM is volatile that’s
loss of contents when the power is failure. A RAM is used to store programs & data that
are temporary & might be change during the course of executing a program.

I/O:
An I/O unit transfers data between the micro computer & the external devices.
The transfer involves data status, address & control signal. The I/O logic is
typically contained in the ROM or RAM chips. A single chip microcomputer has all three
of the basic elements on one chip (there are three main ways of data transferring
between the microcomputer system & the external devices. Such as – Programmed I/O,
Interrupt I/O, DMA). Whereas a single –chip microprocessor has separate chips for
memory & I/O.

When the memory is receiving data from a microcomputer element it is called a WRITE operation.

When the memory is sending data to another microcomputer element it is called a READ operation.

5
Basic microcomputer Registers:

MD. Arshad Ali , (TE-07049)


Microprocessor

Q---Describe the critical Micro processor register with diagram.

There are four basic microprocessor registers -

1. Instruction Register (IR)


2. Program Counter (PC)
3. Memory address Register or data counter(MAR) &
4. Accumulator

Instruction Register (IR):

The IR stores an instruction.


The contents of an instruction register are always decoded by the micro
processor as an instruction. After fetching an instruction code from memory, the
microprocessor stores the instruction register. This instruction is decoded internally by
the microprocessor, which then performs the required operation.

PC:

The PC containing the address of the instruction or operation (op) code. PC is often
called IP (Instruction pointer)
1. Upon activating the microprocessor’s the RESET input, the address of the first
instruction to be executed is loaded into the program counter.
2. The size of the program counter is determined by that of the address bus. The
program counter is typically 32 bits wide for 32 bit microprocessors.

MAR:

The MAR or data counter containing the address of data. The microprocessor
uses the address, which is stored in the memory address register.

6
Accumulator:

MD. Arshad Ali , (TE-07049)


Microprocessor

It stores the result after most ALU operation; and the accumulator is typically
used for inputting a byte to an external device into the accumulator or outputting a
byte to an external device from the accumulator.
The 8-bit microprocessors are accumulator based machines & the accumulator is
typically an 8 bit register.

Memory word
Program Memory

Address Result
2000 21
2001 05 A
2002
2025 MAR

21 IR

2000 PC
Data Memory

2025 05

General Purpose of register:

1. Index register (Used when more Instruction)


2. Status Register (Read Description)
3. Stack pointer Register

Index register:

An index register is typically used as a counter in address notification for an


instruction or general storage function.
The index register is particularly useful with instructions where the tables or array
of data are accessed.
In this operation the index register is used to modify the address portion of the
instruction. Index registers are typically 8 to 16 bits long. Some microprocessors such as
Intel 8085 do not have any index register.
7

MD. Arshad Ali , (TE-07049)


Microprocessor

Status registers:

Also known as a processor status word or condition code register, the status
register contains individual bits with each bit having special significance. The bits in the
status register are called flags. The status flags are used in conditional JUMP
instructions

Flag types: Flag is individual bit

1. Carry flag To be 1 then Negative value & to be Positive va


2. Auxiliary carry flag Flag

3. Zero flag C A Z P S O

4. Parity flag (For Correction) 1 X 1 X 0 1 1 0

5. Sign flag If Numerical value 0 then result is 1


If value 1 then result is 0
6. Overflow flag
If 0 then does not over flow
Fig: Status Register
BCD-(Binary coded decimal)

Carry flag:

The carry flag is used to reflect the condition of whether or not the results
generate by an arithmetic operation is greater than the microprocessor word size. The
addition of two 8 bit numbers produce a carry. The carry flag will be zero if no carry is
generated from the addition.

Auxiliary carry flag:

BCD digit is represented by 4 bits any carry out of the low 4 bits must be
propagated into the high 4 bits for BCD arithmetic.
The carry flag is known as the auxiliary carry flag. It is set to 1 if the carry out of
the low 4 bits is 1; otherwise it is 0.

Zero flag:
8
A zero flag is used to show whether the result of an operation is zero. It is set to 1 if the
result is zero & it is set to 0 if the result is no-zero.

MD. Arshad Ali , (TE-07049)


Microprocessor

Parity flag:

A parity flag is set to 1 to indicate whether the result of the last operation
contains either an even number of 1’s (even parity) or an odd number of 1’s (odd parity).
The parity flag used to determine internal structure of the microprocessor.

Sign flag:

The sign flag have to another name that’s the name is negative flag. It is used to
indicate whether the result of the last operation is positive or negative. This flag is set to
1 indicate that the result is negative & flag is set to 0 that the result is positive.

Overflow flag:

The overflow flag arises from the representation of the sign flag. The overflow flag is
set to 1 if the result of an arithmetic operation is too large or big for the
microprocessor’s maximum word size. Otherwise it is reset to 0.

Stack pointer:

A stack is a last –In- first –Out (LIFO) memory in the sense that items that go in
last will come out first.
The stack can be implemented in hardware or software. A hardware stack is
often designed by using a set of high speed registers in order to provide a fast
response. A software stack can be implemented by using a number of RAM locations.
The address of the stack is contained in a register called the stack pointer.

The PUSH operation is defined as writing to the top or bottom of the stack, whereas the POP
or PULL operation means reading from the top or bottom of the stack

Control Unit:

 The main purpose of this microprocessor section is to read &decoded


instructions from the program memory in order to execute an instruction.
 Contain op-code: Op-code contained in the instruction register.
9
Op-code: The op-code defined the operations to be performed by the control unit in
order to execute an instruction.
MD. Arshad Ali , (TE-07049)
Microprocessor

Control Bus signal:


The control unit generates the control signals that are outputted to the micro-
computer elements via the control Bus.
The control unit also takes appropriate actions in response to the control signals
on the control bus provided by the other microcomputer elements. The control signals
very from one microprocessor to another.

Some common control signal:

i) Reset:
The input is common to all micro processors when this input pin is driven
HIGH or LOW the program counter is reset to 0 in many micro processors
(Intel 8085). The instruction stored at memory location 0000 16 is first execute.

DIP=Dual in pin

1 40
2 39
Reset out 3 38
37
36 Reset in (if 0)
Micro-processor
8085

18 23
19 22
20 21

ii) Read / Write: This output line is common to all micro processor. The status of
this line tells the other micro computer elements whether the micro
processors is performing a READ or WRITE operation. A HIGH signal on this
line indicates a READ operations & a LOW indicate a WRITE operation.

10
RAM
1 40
2 39
Output 3 38
Register
MD. Arshad Ali , (TE-07049) 37
36
Micro-processor (0)
32
18 23
19 22
20 21
Microprocessor

Short note: If stay active bar


then don’t work by 1. & at a
time does not stay 0 two
position.

iii) ´ :
Ready
This is an input to the micro processor Slow devices (Memory & I/O)
use. This signal to gain extra time to transfer data to or receive data from a
micro processor.
´ signal is usually a negative logic signal i.e. LOW means it is Ready.
The Ready

1 40
2 39
3 38
37
36 if 0)
Micro-processor
8085

18 23
19 22
20 21

iv) Interrupt Request (INT or IRQ):


The external I/O device can interrupt the micro processor via this input
pin on the microprocessor chip.
When this signal is activated by the external devices, the microprocessor
jumps to a special program called the interrupt service routine. This program
is normally written by the user for performing task that the interrupting
device wants the microprocessor to do.

ALU:
INTR
INTA
10
11
µP 11
The ALU performs all the data manipulations such as arithmetic & logic operations
inside the microprocessor. Typically the ALU performs the following operations –
MD. Arshad Ali , (TE-07049)
Microprocessor

1. Binary addition & Logic operations


2. Finding 1’s complement of data
3. Shifting or rotating the contents of the accumulator or some other register 1 bit
to the left or right through carry.

Functional representation of a simple microprocessor:

Data Bus
Status register Accumulator

Memory Address Register


Shifter

Program Counter
Complementer

Instruction Register
Addition & Boolean Logic

Buffer register
CU

Micro processor logically divided to three groups-

i. Register section
ii. Arithmetic & logic unit (ALU)
iii. Timing & control section (CU)

A typical memory chip: 12


1K x 8 RAM

Address Data out


Data in

MD. Arshad Ali , (TE-07049) (8 bit=1 bite


CS1
210=1 k=1024)
CS2
Microprocessor

Memory cell

0 Word
1
2
3
Short note: Here Address line =4, so Word line is 24
4
Word line

5
6
7
88
98
10
11
12
13
14
15

** 2k = Total no. of Words

Capacity = 2k x length of words {here length of words is 8. & k is no. of address}

DMA (Direct Memory Access):


13
DMA means Direct Memory access. DMA is extensively used in transferring large
Blocks of data between a peripheral device & micro-computer Memory.

MD. Arshad Ali , (TE-07049)


Microprocessor

DMA performs data transfer between memory & an external device without
involving the microprocessor. The interface or controller chip must be able to perform
memory READ & WIRTE operations in a similar way as the microprocessor.

Block Diagram of DMA:

Address Bus
Data Bus
HOLD
HLDA
R/
Decoding logic
RAM
Micro-processor

CS
DMA
CS I/O
DMA Request
RS
DMA Acknowledgement

Features of Intel 8085:


14
 8 bit NMOS microprocessor (MOS= Metal Oxide Semiconductor )

MD. Arshad Ali , (TE-07049)


Microprocessor

 Packaged 40 pin DIP (Dual in line package)


 Requires +5v Power supply
 Clock signals, system control, interrupt circuitory in the same chip.
 (3 Versions)The internal clock frequency 3 MHz For 8085 AH
5 MHz For 8085 AH2
6 MHz For 8085 AH1 [AH- in hands]

8085 Register & status flag:

S Z AC P C Program status word (PSW)


Input – PUSH (PUSH) is terms which insert an element.

A= Accumulator
A

B C
Secondary accumulator data counter
D E

H L Primary data counter


Stack pointer
SP
PC Program counter

The accumulator (A) is an 8-bit register, most of the arithmetic & logic operations are
performed using the accumulator. All I/O data transfer between the 8085 & the I/O
devices are performed via the accumulator

The B, C, D, E, H & L registers are each 8-bits long. H & L are the memory address
register or data counter. Combine two 8-bit register to form 16-bit register pair.
15
PSW & A

MD. Arshad Ali , (TE-07049)


Microprocessor

B & C

D & E

H & L

High-order Byte Low –order Byte

The 16-bit register pair obtained by combing the accumulator & the PSW is used only for
stack operations. Arithmetic operations Use B & C, or D &E, or H & L as 16-bit data
register.
The PSW consist five status flag –

Carry flag:
The carry flag reflect the final carry out of the most significant bit of any
arithmetic operation.

Parity flag:

The parity flag (P) is set to 1 if an arithmetic or logic instruction generates an


answer with even parity i.e. containing an even no. of 1 bits.
This flag is 0 if the arithmetic or logic instruction generates an answer with odd
parity, i.e. containing an odd no. of 1’s.

Auxiliary carry:
The ‘AC’ flag reflects any carry from bit 3 to bit 4 due to arithmetic operation. This
flag is useful for BCD operations.

Zero flag:
The ‘Z’ flag is set to 1 whenever an arithmetic or logic operation produces a result
of zero. The zero flag is cleared to 0 for a nonzero result due to arithmetic or a logic
operation.

Sign status flag:


16
The ‘S’ flag is set to the value of the most significant bit of the result in the
accumulator after an arithmetic or a logic operation.

MD. Arshad Ali , (TE-07049)


Microprocessor

 The Intel 8085 does not have any overflow flag.

Stack pointer:

The stack pointer is 16 bits long. All stack operations with the 8085 use 16-bit
register pairs. The stack pointer contains the address of the last data byte written into
the stack.
(It is decremented by 2 each time 2 bytes of data are written or pushed onto the
stack & is incremented by 2 each time 2 bytes of data are read from or pulled off the
stack, i.e. the top of the stack has the lowest address in the stack that grows
downward).
PC:

The program counter is 16 bits long to address up to 64K of memory. It is usually


address the next instruction to be executed.

8085 Addressing modes: (Important for exam, also instruction set)

8085 Have five Addressing modes –

 Direct addressing mode


 Register addressing mode
 Register Indirect addressing mode
 Implied or Inherent addressing mode
 Immediate addressing mode.

17
Direct addressing mode:

MD. Arshad Ali , (TE-07049)


Microprocessor

Instruction using this mode specifies the effective address as part of instruction.
Instructions using this mode contain 3 bytes, with the first byte as the opcode followed
by 2 bytes of address of data. EX:- Instruction LDA 2035H(Load Accumulator). This mode
is also called the absolute mode.

Opcode

Lower order byte

Higher order byte

Fig: Three byte Instruction

Register addressing mode:


This mode specifies the register or register pair that contains data. For example:
MOV B, C moves the content of register C to register B.

Register indirect addressing mode:


This mode contains a register pair that stores or contains the address of data.
Example- LDAX B loads the accumulator with the contents of a memory location
addressed by the B, C register pair.

Implied or Inherent addressing mode:


This instruction using this mode has no operands. Ex- STC (Set carry flag)

Immediate addressing mode:

For an 8 bit data, this mode use 2 bytes with first byte as the opcode followed by
1 byte of data. On the other hand for 16 bit data, this instruction contains 3 bytes, with
the first byte as the Op code followed by 2 bytes of data.
Example: MVI B, 05 loads register B with 5

18
Internal architecture of the 8086 microprocessor:

MD. Arshad Ali , (TE-07049)


Address bus (20bit)
AH AL AX
Data bus (16bit)
BH BL BX

Microprocessor CH CL CX CS

DH DL DX DS

SP SS
General register
BP ES

DI IP

SI Internal communicate- on register


Bus control logic
8086 bus

ALU data Bus (16bit)

Temporary Register

Instruction queue
ALU Q bus
I/O Control system
(8bit) 1 2 3 4 5 6

Bus interface unit (BIU)


Flags

Execution unit (EU)

19
Addressing mode of 8086 microprocessor:

1. Register & Immediate mode


MD. Arshad Ali , (TE-07049)
Microprocessor

2. Memory addressing mode


a. Memory direct addressing mode
b. Register indirect addressing mode
c. Based addressing mode
d. Index addressing mode
e. Based index addressing mode
f. String addressing mode
3. Port addressing mode
4. Relative addressing mode
5. Implied addressing mode

Register & Immediate mode:

In register mode, source operands, destination operands or both may be


contained in registers. E.g. MOV AX, BX moves the 16-bit contents of BX into AX. On the
other hand MOV AL, BL moves the 8-bit contents BL into AL.
In immediate mode 8bit or 16 –bit data can be specified as a part of the
instruction. E.g. MOV CX, 5062H moves the 16-bit data 5062 16 into register CX.

Memory addressing mode:

The EU has direct access to all registers & data for register & immediate modes.
However the EU can not directly access the memory operands.
It must use the BIU in order to access memory operand. Every memory
addressing mode has a standard default segment register.

Memory direct addressing mode:

In this mode the effective address is taken directly from the displacement field of
the instruction. No registers are involved. E.g. MOV BX, START moves the contents of
the 20-bit address from DS & START to BX.

Register indirect addressing mode:

The effective address of a memory operand may be taken directly from one of
the base or index registers (BX, BP, SI, DI). E.g MOV CX, [BX]
20
Based addressing mode:

MD. Arshad Ali , (TE-07049)


Microprocessor

In this mode the effective address is the sum of a displacement value & contents
of BX register. E.g. MOV AX, 4[BX] moves the contents of the 20-bit address computed
from a segment register & [BX +4] into AX.

Index addressing mode:

In this mode the effective address is calculated from the sum of a displacement
value & the contents of register SI or DI. E.g. MOV AX, VALUE [SI] moves the contents of
the 20-bit address computed from VALUE, SI & the segment register into AX.

Based Indexed addressing mode:

In this mode the effective address is computed from the sum of a base register
(BX or BP) an index register (SI or DI) and a displacement. E.g MOV AX, 4[BX][SI] moves
the content of the 20-bit address computed from the segment register & [BX] + [SI] + 4
into AX.

String addressing mode:

This mode uses Index registers.SI is assumed to point the first byte or word of
the source string. & DI is assumed to point to the first byte or word of the destination
when a string instruction is executed. Example MOVS WORD.

Port addressing mode:

Two I/O port addressing modes can be used; the direct & indirect port modes. In
case of 8- or 16-bit I/O transfers must taken place via AL or AX respectively.
In direct port mode the port number is an 8-bit immediate operand to access 256
ports. E.g. IN AL, 02 moves the contents of port 02 to AL.
In indirect mode the port number is taken from DX Allowing 64K bytes or 32K
words of ports.

21
Relative addressing mode:

MD. Arshad Ali , (TE-07049)


Microprocessor

In this mode using instruction specify the operand as a signed 8-bit displacement
relative to PC. E.g. JNC START. This instruction means that is carry =0 then PC is loaded
with current PC contents plus the 8-bit signed value of START; otherwise the next
instructions is executed.

Implied addressing mode:

In this mode using instruction have no operands. An example is CLC which clears the
carry flag to zero.

8086 Instruction set:

The 8086 has approximately 117 different instructions with about 300 OP codes.
The 8086 instruction set contains no-operand, single operand, two-operand, string
(array) instruction.8086 instructions do not permit memory to memory operations.

AAA – ASSCII Adjust after Addition


AAD - ASSCII Adjust after division
AAM - ASSCII Adjust after Multiply
AAS - ASSCII Adjust after subtraction

There are five types of Instruction set –

1. Data transfer Instruction:


These instruction moves single bye & words between a register & I/O
ports. Example – MOV CX, DX copies the 16-bit contents of DX into CX. MOV AX,
2025H moves immediate data 2025H into the 16-bit register AX.
2. Arithmetic instruction:
The operations can be performed on 4 types of numbers: Unsigned binary,
signed binary, unsigned packed decimal & singed packed decimal.
Binary number can be 8-nit or 16-bits wide. (Decimal numbers are stored in
bytes – two digits per byte for packed decimal & one digit per byte for unpacked
decimal with the high 4 bits filled with zeros.) Example ADC AX, [BX]
22
3. Bit Manipulation Instruction:
The 8086 three groups of bit manipulation instructions. These are logical,
Shift & rotate. The operand to be shifted or rotated can be either 8-bit or 16-bit.
MD. Arshad Ali , (TE-07049)
Microprocessor

4. Unconditional transfer Instruction:


Unconditional transfer instructions transfer control to a location either in
the current executing memory segment.

5. Conditional Instructions:
All 8086 conditional branch instructions use 8-bit singed displacement. i.e.
the displacement covers a branch range of -128 10 to +12710 with 0 being positive.

8086 Input/output:

 Memory mapped I/O


 Programmed I/O or standard I/O

Programmed I/O:

The standard I/O uses the instructions IN & OUT is capable of providing up to 64K
bytes of I/O locations. The standard I/O can transfer either 8-bi data or 16-bit data to or
from a peripheral device.
The 64K 8-byte I/O locations configured as 64K 8-bit ports or 32K 32-bit ports. All
I/O transfers between the 8086 & peripheral devices take place via AL for 8-bit ports
(AH is not involved) & AX for 16-bit ports. The I/O port addressing can be done either
directly or indirectly.
Direct:

IN AX, PORTA or IN AL, PORTA inputs 16-bit contents of port A into AX or 8-bit
contents of port A into AL respectively.

OUT PORTA, AX or OUT PORTA, AL outputs 16-bit contents of AX into Port A or 8-


bit contents of AL into port A respectively.

23

MD. Arshad Ali , (TE-07049)


Microprocessor

Indirect:

IN AX, DX or IN AL, DX inputs 16-bit data addressed by DX or 8-bit data addressed


by DX into AL respectively.
OUT DX, AX or OUT DX, AL outputs 16-bit contents of AX into the port addressed by DX
or 8-bit contents of AL into the port addressed by DX, respectively.

Memory Mapped I/O:

Memory mapped I/O is basically accomplished by using the memory Instructions


such as-
MOV AX, [BX] & MOV [BX], AX.
MOV AL, [BX] & MOV [BX], AL. for inputting or outputting 8- or 16-bit data into AX (16
bit) or AL (8 bit) register addressed by the 20-bit memory mapped address computed
from DS & BX.

A, B, & C are the Ports. Ports A & B are latched 8-bit I/O ports for both input &
output. Port C is also an 8-bit port with latched output only.

8086 Interrupts:

The 8086 interrupts can be classified into three types such as –

1. Predefined interrupts.
2. User-define software interrupts.
3. User-defined hardware interrupts.

24
Predefined interrupts:
MD. Arshad Ali , (TE-07049)
Microprocessor

1. Type 0 : INT0 Divided by Zero


2. Type 1 : INT1 Single step
3. Type 2 : INT2 Non-mask able interrupt
4. Type 3 : INT3 Breakpoint
5. Type 4 : INT4 Interrupt on overflow

25

MD. Arshad Ali , (TE-07049)

You might also like