EEE511_Microprocessor and Microcontroller
EEE511_Microprocessor and Microcontroller
ON
Microcomputer
A microcomputer is a small, relatively inexpensive computer with a microprocessor as its central
processing unit (CPU). It includes a microprocessor, memory and minimal input/output (I/O) circuitry
2
Random Access Memory (RAM) (also known as Read/Write Memory). • used to store information
supplied by the user. Such as pro www.noteshit.com grams and data.
Concept of Address bus, data bus, control bus & System Bus
A bus is a group of wires/lines that carry similar information. 8085 MP uses a number of busses,
collection of wires, which transmit binary numbers, one bit per wire. A typical microprocessor
communicates with memory and other devices (input and output) using three busses: Address Bus,
Data Bus and Control Bus.
Address Bus: The address bus is a group of 16 lines generally identified as A0 to A15. The address bus is
unidirectional: bits flow in one direction-from the MPU to peripheral devices. The MPU uses the
address bus to perform the first function: identifying a peripheral or a memory location.
Data Bus: INTEL 8085 is a 8 bit microprocessor. The data bus is a group of eight lines used for data flow.
8 bit of data can be transmitted in parallel form. These lines are bi-directional - data flow in both
directions between the MPU and memory and peripheral devices. The MPU uses the data bus for
transferring binary information. The eight data lines enable the MPU to manipulate 8-bit data ranging
from 00 to FF (28 = 256 numbers).
Control Bus: The control bus carries synchronization signals and providing timing signals. The MPU
generates specific control signals for every operation it performs. These signals are used to identify a
device type with which the MPU wants to communicate.
3
Basic Architecture of 8085 (8 bit) Microprocessor
The 8085 microprocessor is an 8-bit processor available as a 40-pin IC package and uses +5 V for
power. It can run at a maximum frequency of 3 MHz. Its data bus width is 8-bit and address bus
width is 16-bit, thus it can address 216 = 64 KB of memory.
It consists of the following:
Control Unit Generates signals within µP to carry out the instruction, which has been decoded. In
reality causes certain connections between blocks of the µP to be opened or closed, so that data goes
where it is required, and so that ALU operations occur.
Arithmetic Logic Unit The ALU performs the actual numerical and logic operation such as ‘add’,
‘subtract’, ‘AND’, ‘OR’, etc. Uses data from memory and from Accumulator to perform arithmetic.
Always stores result of operation in Accumulator.
Registers The 8085 includes six registers, one accumulator, and one flag register. In addition, it has two
16-bit registers: the stack pointer and the program counter. The 8085 has six general- purpose
registers to store 8-bit data; these are identified as B, C, D, E, H, and L as shown in the figure. They
can be combined as register pairs - BC, DE, and HL - to perform some 16-bit operations. The
programmer can use these registers to store or copy data into the registers by using data copy
instructions.
Temporary Register: It is used to hold the data during the arithmetic and logical operations. Instruction
Register: When an instruction is fetched from the memory, it is loaded in the instruction register.
Instruction Decoder: It gets the instruction from the instruction register and decodes the instruction. It
identifies the instruction to be performed.
Serial I/O Control: It has two control signals named SID and SOD for serial data transmission.
Timing and Control unit: It has three control signals ALE, RD (Active low) and WR (Active low) and
4
signals IO/M(Active low), S0 and S1. ALE is used for provide control signal to synchronize the
components of microprocessor and timing for instruction to perform the operation. RD (Active low)
and WR (Active low) are used to indicate whether the operation is reading the data from memory or
writing the data into memory respectively.IO/M(Active low) is used to indicate whether the
operation is belongs to the memory or peripherals.
• Address bus
• Data bus
5
• AD0 – AD7 (input/output, 3-state): Lower significant bits of memory addresses and the eight bits of
the I/O addresses during first clock cycle. Behaves as data bus during third and fourth clock cycle. These
lines enter into tri-state high impedance state during HOLD and HALT modes.
Control & Status Signals:
• ALE: Address latch enable -It occurs during the first clock cycle of a machine state and enables the
address to get latched into the on chip latch of peripherals.
• RD : Read - indicates the selected memory or 1/0 device is to be read and that the Data Bus is
available for the data transfer.
• WR : Write- ; indicates the data on the Data Bus is to be written into the selected memory or 1/0
location. Data is set up at the trailing edge of WR.
• IO/M -it is a status signal which distinguishes whether the address is for memory or I/O. when it goes
high the address on the address bus is for an I/O device. When it goes low the address on the address
bus is for a memory location.
S1 and S0 : Data Bus Status. Encoded status of the bus cycle shown in
table .
• HOLD: This signal indicates that a peripheral like DMA (direct memory access) controller is requesting
the use of address and data bus.
• HLDA: This signal acknowledges the HOLD request.
6
• INTR: Interrupt request is a general-purpose interrupt.
• INTA : This is used to acknowledge an interrupt.
• RST 7.5, RST 6.5, RST 5.5 – restart interrupt: These are vectored interrupts and have higher priority
than INTR interrupt.
• TRAP: This is a non-maskable interrupt and has the highest priority.
Register Organizations, Distinguish between SPR & GPR, Timing & Control
Module
Registers:-it is a collection of flip flops use to store a binary word. They are used by the microprocessor
for the temporary storage and manipulation of data and instructions.
The various registers of 8085 can be broadly categorized in two sections, namely General Purpose
Registers(GPR) and Special Purpose Registers(SPR) .
GPR
The 8085 has six general-purpose registers to store 8-bit data; these are identified as B, C, D, E, H, and L
as shown in the figure.
They can be combined as register pairs - BC, DE, and HL - to perform some 16-bit operations. The
programmer can use these registers to store or Register organization copy
data into the registers by using data copy instructions.
7
SPR
The different SPRs and their functions are mentioned below.
Accumulator (A): It is an 8-bit register that is part of the arithmetic/logic unit (ALU). Used to store 8-bit
data and to perform arithmetic and logical operations. The result of an operation is stored in the
accumulator.
Flags: The ALU includes five flip-flops that are set or reset according to the result of an operation. The
microprocessor uses the flags for testing the data conditions. They are Zero (Z), Carry (CY), Sign (S),
Parity (P), and Auxiliary Carry (AC) flags.
Sign Flag (S): After execution of any arithmetic and logical operation, if D7 of the result is 1, the sign
flag is set. Otherwise it is reset. D7 is reserved for indicating the sign; the remaining is the magnitude of
number. If D7 is 1, the number will be viewed as negative number. If D7 is 0, the number will be viewed
as positive number.
Zero Flag (z): If the result of arithmetic and logical operation is zero, then zero flag is set otherwise it is
reset.
Auxiliary Carry Flag (AC): If D3 generates any carry when doing any arithmetic and logical operation,
this flag is set. Otherwise it is reset
Parity Flag (P): If the result of arithmetic and logical operation contains even number of 1's then this
flag will be set and if it is odd number of 1's it will be reset.
Carry Flag (CY): If any arithmetic and logical operation result any carry then carry flag is set otherwise it
is reset.
Program Counter (PC): This 16-bit register sequencing the execution of instructions. It is a memory
pointer. Memory locations have 16-bit addresses, and that is why this is a 16-bit register. The function
of the program counter is to point to the memory address of the next instruction to be executed. When
an opcode is being fetched, the program counter is incremented by one to point to the next memory
location.
Stack Pointer (SP): The stack pointer is also a 16-bit register used as a memory pointer. It points to a
memory location in R/W memory, called the stack. The beginning of the stack is defined by loading a
16-bit address in the stack pointer.
Temporary Register: It is used to hold the data during the arithmetic and logical operations.
Instruction Register: When an instruction is fetched from the memory, it is loaded in the instruction
register. Instruction Decoder:
8
Program Status Word(PSW): It is a combination of 8 bits where five bits indicate the 5 status flags &
three bits are undefined. Psw and the accumulator are treated as a 16-bit unit for stack operation.
Timing and Control unit:
It has three control signals ALE, RD (Active low), and WR (Active low), and three status signals
IO/M(Active low), S0, and S1.
1. ALE is used to provide the control signal to synchronize the components of the
microprocessor and timing for instruction to perform the operation.
2. RD (Active low) and WR (Active low) are used to indicate whether the operation is reading the
data from memory or writing the data into memory respectively.
3. IO/M(Active low) is used to indicate whether the operation belongs to the memory or
peripherals.
9
Interrupts:-8085 Interrupts, Masking of Interrupt(SIM,RIM)
Interrupt is a process where an external device can get the attention of the microprocessor. The
process starts from the I/O device .The process is asynchronous. An interrupt is considered to be an
emergency signal. The Microprocessor should respond to it as soon as possible. When the
Microprocessor receives an interrupt signal, it suspends the currently executing program and jumps to
an Interrupt Service Routine (ISR) to respond to the incoming interrupt. Responding to an interrupt may
be immediate or delayed depending on whether the interrupt is maskable or non-maskable and
whether interrupts are being masked or not.
Interrupts can be classified into two types:
Software interrupts
Maskable (can be delayed) • Non-Maskable (can not be delayed)
The maskable interrupt process in the 8085 is controlled by a single flip flop inside the microprocessor.
This Interrupt Enable flip flop is controlled using the two instructions “EI” and “DI”. The 8085 has a
single Non-Maskable interrupt. The non-maskable interrupt is not affected by the value of the
Interrupt Enable flip flop.
• hardware Interrupts
Vectored (the address of the service routine is hard-wired) • Non-vectored (the address of the service
routine needs to be lied externally)
. • There are two ways of redirecting the execution to the ISR depending on whether the interrupt is
vectored or non-vectored. – The vector is already known to the Microprocessor – The device will have
to supply the vector to the Microprocessor The 8085 Interrupts
The 8085 has 5 interrupt inputs.
– The INTR (input) • The INTR input is the only non-vectored interrupt. • INTR is maskable using the
EI/DI instruction pair.it is an interrupt request signal. Among interrupts it has the lowest priority. An
interrupt is used by i/o devices to transfer data to the microprocessor without wasting its time.
INTA (output)-it is an interrupt acknowledgement sent by the microprocessor after INTR is received.
RST 5.5, RST 6.5, RST 7.5(input) are all automatically vectored. • RST 5.5, RST 6.5, and RST 7.5 are all
maskable. Signals are the restart interrupt, they causes an internal restart to be automatically inserted
each of them of a programmable mask.
TRAP Trap interrupt is a non maskable restart interrupt. It is unaffected by any mask or Interrupt
Enable. It has the highest priority of any interrupt. TRAP is also automatically vectored.
Order of priority-
TRAP RST 7.5---- RST 6.5 --- RST 5.5 -- INTR
10
When an interrupt is recognized the next instruction is executed from a fixed location in memory. A
subroutine is executed which is called ISS(interrupt service subroutine).
EXTRA for information
8085 Functional Description
The 8085A is a complete 8 bit parallel central processor. It requires a single +5 volt supply. Its basic clock speed is
3 MHz thus improving on the present 8080's performance with higher system speed. Also it is designed to fit into
a minimum system of three IC's: The CPU, a RAM/ IO, and a ROM or PROM/IO chip. The 8085A uses a
multiplexed Data Bus. The address is split between the higher 8bit Address Bus and the lower 8bit Address/Data
Bus. During the first cycle the address is sent out. The lower 8bits are latched into the peripherals by the Address
Latch Enable (ALE). During the rest of the machine cycle the Data Bus is used for memory or l/O data. The 8085A
provides RD, WR, and lO/Memory signals for bus control. An Interrupt Acknowledge signal (INTA) is also
provided. Hold, Ready, and all Interrupts are synchronized. The 8085A also provides serial input data (SID) and
serial output data (SOD) lines for simple serial interface. In addition to these features, the 8085A has three
maskable, restart interrupts and one nonmaskable trap interrupt. The 8085A provides RD, WR and IO/M signals
for Bus control. Status information is directly available from the 8085A. ALE serves as a status strobe. The status
is partially encoded, and provides the user with advanced timing of the type of bus transfer being done. IO/M
cycle status signal is provided directly also. Decoded So, S1 Carries the following status information: HALT,
WRITE, READ, FETCH S1 can be interpreted as R/W in all bus transfers. In the 8085A the 8 LSB of address are
multiplexed with the data instead of status. The ALE line is used as a strobe to enter the lower half of the address
into the memory or peripheral address latch. This also frees extra pins for expanded interrupt capability.
The8085A has5 interrupt inputs: INTR, RST5.5, RST6.5, RST 7.5, and TRAP. Each of the three RESTART inputs, 5.5,
6.5. 7.5, has a programmable mask. TRAP is also a RESTART interrupt except it is non- maskable. The three
RESTART interrupts cause the internal execution of RST (saving the program counter in the stack and branching
to the RESTART address) if the interrupts are enabled and if the interrupt mask is not set. The non-maskable
TRAP causes the internal execution of a RST independent of the state of the interrupt enable or masks. The
interrupts are arranged in a fixed priority that determines which interrupt is to be recognized if more than one is
pending as follows: TRAP highest priority, RST 7.5, RST 6.5, RST 5.5, INTR lowest priority This priority scheme does
not take into account the priority of a routine that was started by a higher priority interrupt. RST 5.5 can
interrupt a RST 7.5 routine if the interrupts were re-enabled before the end of the RST 7.5 routine. The TRAP
interrupt is useful for catastrophic errors such as power failure or bus error. The TRAP input is recognized just as
any other interrupt but has the highest priority. It is not affected by any flag or mask. The TRAP input is both
edge and level sensitive.
11
Instruction Set and Assembly Language Programming
An instruction is a command to the microprocessor to perform a given task on specified data.
Each instruction has two parts: one is the task to be performed, called the operation code (opcode),
and the second is the data to be operated on, called the operand. The operand (or data) can be
specified in various ways. It may include 8-bit (or 16-bit ) data, an internal register, a memory location,
or an 8-bit (or 16-bit) address. In some instructions, the operand is implicit.
12
An instruction is a binary pattern designed inside a microprocessor to perform a specific function. The
entire group of instructions, called the instruction set, determines what functions the microprocessor
can perform. These instructions can be classified into the following five functional categories: data
transfer (copy) operations, arithmetic operations, logical operations, branching operations, and
machine-control operations.
13
Example: LXI H, 0520H
14
Transfer a copy of a byte or word from source register to destination register.
Ex: MOV B, C
IX. Indirect addressing :
In register indirect addressing mode, the data to be operated is available inside a memory location and that
memory location is indirectly specified by a register pair.
[Indirect addressing uses the data in a register pair as a 16-bit address to identify the memory location
being accessed. – The HL register pair is always used in conjunction with the memory register “M”. –
The BC and DE register pairs can be used to load data into the Accumultor using indirect addressing.]
Eg: LXI H, 4050H
MOV A,M
X. Implicit addressing:
In this addressing mode the instruction itself specifies the data to be operated upon.
Ex: CMA
[The instruction complements the content of the accumulator. No specific data or operand is mentioned in
the instruction]
2.3 Instruction Set of 8085(Data Transfer, Arithmetic, Logical, Branching, Stack& I/O,
Machine Control)
Data Transfer Operations –
These operations simply COPY the data from the source to the destination.
MOV, MVI, LDA, and STA – They transfer:
• Data between registers. • Data Byte to a register or memory location. • Data between a memory
location and a register. • Data between an I\O Device and the accumulator.
The data in the source is not changed
The LXI instruction
• The 8085 provides an instruction to place the 16-bit data into the register pair in one step.
• LXI Rp, (Load eXtended Immediate) –
The instruction LXI B 4000H
will place the 16-bit number 4000 into the register pair B, C. • The upper two digits are placed in the
1st register of the pair and the lower two digits in the 2nd .
15
• Most of the instructions of the 8085 can use a memory location in place of a register. The memory
location will become the “memory” register M.
• MOV M B – copy the data from register B into a memory location.
Which memory location?
• The memory location is identified by the contents of the HL register pair. – The 16-bit contents of the
HL register pair are treated as a 16-bit address and used to identify the memory location .
ARITHMATIC INSTRUCTION
Addition (ADD, ADI):
– Any 8-bit number : ADI 40h
The contents of a register. ADD C
Increment (INR) and Decrement (DCR): • The 8-bit contents of any memory location or any register can
be directly incremented or decremented by 1. • No need to disturb the contents of the accumulator.
Logic Operations
• These instructions perform logic operations on the contents of the accumulator.
ANA, ANI, ORA, ORI, XRA and XRI
16
• Source: Accumulator and – An 8-bit number – The contents of a register – The contents of a memory
location
• Destination: Accumulator
ANA R/M AND Accumulator With Reg/Mem
ANI # AND Accumulator With an 8-bit number
ORA R/M OR Accumulator With Reg/Mem
ORI # OR Accumulator With an 8-bit number
XRA R/M XOR Accumulator With Reg/Mem
RLC Rotate the accumulator left. Bit 7 goes to bit 0 AND the Carry flag.
RAL Rotate the accumulator left through the carry. Bit 7 goes to the carry and carry goes to bit 0.
RRC Rotate the accumulator right. Bit 0 goes to bit 7 AND the Carry flag.
RAR Rotate the accumulator right through the carry. Bit 0 goes to the carry and carry goes to bit 7.
Compare • Compare the contents of a register or memory location with the contents of the
accumulator.
CMP R/M Compare the contents of the register or memory location to the contents of the
accumulator.
CPI # Compare the 8-bit number to the contents of the accumulator. • The compare instruction sets
the flags (Z, Cy, and S). • The compare is done using an internal subtraction that does not change the
contents of the accumulator. (R / M / #)
Branch Operations • Two types:
17
Unconditional branch. • Go to a new location no matter what– JMP Address • Jump to the address
specified (Go to).
Conditional Branch – Go to new location if a specified condition is met. • JZ Address (Jump on Zero) –
Go to address specified if the Zero flag is set. • JNZ Address (Jump on NOT Zero) – Go to address
specified if the Zero flag is not set. • JC Address (Jump on Carry) – Go to the address specified if the
Carry flag is set. • JNC Address (Jump on No Carry) – Go to the address specified if the Carry flag is not
set.
Machine Control – HLT • Stop executing the program. – NOP • No operation • Exactly as it says, do
nothing. • Usually used for delay or to replace instructions during debugging.
Program1. Write an assembly language program to Load the contents of memory locations 2100 H
and 2101 H in the B-register and C register respectively. The content of memory locations 2100 H and
2101H are 16 H and 19 H respectively.
18
Logic Operations (AND, OR, Complement 1’s & 2’s) & Masking of bits
Program 2.
Write an assembly language program to find the 2’s complement of a hexadecimal number. The hexadecimal
number 6A H is stored in memory location 2100H and the answer is to be stored in 2101 H.
Program 3.
Write an assembly language program add two numbers 26h and 40h, then subtract number 3 from the
sum. The final answer is to be stored in memory location 2100 H.
Program 4.
19
Write a program in assembly language to mask off the least significant 4 bits of a given hexadecimal
number. The answer should be stored in memory location 2200 H. Let the given number is B3 H.
Solution.
The binary equivalent of B3 H is 1011 0011. The masking of the 4 least significant bits 0011 means to
make 0011 to 0000. However, the four most significant bits should not be changed.
This can be done if the given number is ANDed with F0 H (1111 0000). In doing so when 4 most significant bits
are ANDed with 1111 no change will be there, but 4 least significant bits will be 0000 as required.
TIMING DIAGRAMS
Define opcode, operand, T-State, Fetch cycle, Machine Cycle, and
Instruction cycle & discuss the concept of a timing diagram.
Opcode & Operand
An instruction is a command to the microprocessor to perform a given task on specified data. Each
instruction has two parts:
The first part is the task or operation to be performed. This part is called the “opcode” (operation
code).
20
The second part is the data to be operated on is called the “operand”. The operand (or data) can be
specified in various ways. It may include 8-bit (or 16-bit ) data, an internal register, a memory location,
or 8-bit (or 16-bit) address. In some instructions, the operand is implicit.
Machine Cycle
The time required by the microprocessor to complete an operation of accessing memory or
input/output devices is called machine cycle.
Instruction cycle
Time required by the microprocessor to execute and fetch an entire instruction is called instruction
cycle. It consists:
• Fetch cycle – The next instruction is fetched by the address stored in program counter (PC) and
then stored in the instruction register.
• Decode instruction – Decoder interprets the encoded instruction from instruction register.
• Reading effective address – The address given in instruction is read from main memory and
required data is fetched. The effective address depends on direct addressing mode or indirect
addressing mode.
• Execution cycle – consists memory read (MR), memory write (MW), input output read (IOR) and
input output write (IOW)
T-State
One time period of frequency of microprocessor is called t-state. A t-state is measured from the
falling edge of one clock pulse to the falling edge of the next clock pulse.
TIMING DIAGRAM
It is the graphical representation of process in steps with respect to time. The timing diagram
represents the clock cycle and duration, delay, content of address bus and data bus, type of operation
ie. Read/write/status signals.
[Extra -Instruction flow( opcode)]
Timing Diagram is Representation of Various Control signals generated during Execution of an
Instruction.
Following Buses and Control Signals must be shown in a Timing Diagram:
• Higher Order Address Bus.
• ALE
• RD
• WR
21
• IO/M
S0 , S 1
Draw a timing diagram for memory read, memory write, I/O read, I/O write machine
cycle.
Opcode fetch timing Operation:
The microprocessor requires instructions to perform any particular action. In order to perform these
actions microprocessor utilizes opcode which is part of an instruction that provides detail to the
microprocessor.
➢ During T1 state, microprocessor uses IO/M(bar), S0, S1 signals are used to instruct microprocessor to
fetch opcode.
➢ During this operation 8085 transmits a 16-bit address and also uses an ALE signal for address
latching. ➢ At T2 state microprocessor uses a read signal and makes data ready from that memory
location to read opcode from memory and at the same time program counter increments by 1 and
points next instruction to be fetched.
22
➢ In this state microprocessor also checks READY input signal, if this pin is at low logic level ie. '0' then
microprocessor adds wait state immediately between T2 and T3.
➢ At T3, the microprocessor reads the opcode and stores it in instruction register to decode it further.
➢ The opcode is decoded to know whether T5 or T6 states are required, if they are not required then
the processor performs the next operation.
➢ It requires 3 T-States.
23
➢ During T1, A8-A15 contains a higher byte of address. At the same time, ALE is high. Therefore
Lower byte of address A0-A7 is selected from AD0-AD7.
➢ During T2 ALE goes low, RD(bar) goes low. The address is removed from AD0-AD7 and data
D0-D7 appears on AD0-AD7.
24
➢ It requires 3 T-States.
➢ During T1, ALE is high and contains lower address A0-A7 from AD0-AD7.
➢ A8-A15 contains a higher byte of address. As it is a memory operation, IO/M goes low.
➢ During T2, ALE goes low, WR goes low and Address is removed from AD0-AD7 and then data appears
on AD0-AD7.
➢ It requires 3 T-States.
➢ During T1, the lower byte of address is duplicated into higher order address bus A8-A15.
➢ During T2, ALE goes low, WR goes low and data appears on AD0-AD7 to write data into the IO device.
➢
During T3, Data remains on AD0-AD7 till WR is low.
25
Draw a neat sketch for the timing diagram for 8085 instruction (MOV, MVI,LDA
instruction).
MOV:
Instruction: A000h MOV A, B
MVI
26
LDA
Instruction:
Corresponding Coding:
A000h OPCODE
A001h 45
A002h F0
27
MOV M,A
28
Microprocessor Based System Development Aids
Interfacing
Interfacing means using the processor for different tasks with a compatible device.
The interfacing circuit or chip can be programmed according to requirements. For interfacing we use a
chip called peripheral interface (PPI), intel 8255.
It is a tri-state 8-bit buffer, which is used to interface the microprocessor to the system data bus. Data is
transmitted or received by the buffer as per the instructions by the CPU. Control words and status
information is also transferred using this bus.
29
Read/Write Control Logic
This block is responsible for controlling the internal/external transfer of data/control/status word. It
accepts the input from the CPU address and control buses, and in turn issues command to both the
control groups.
CS
It stands for Chip Select. A LOW on this input selects the chip and enables the communication between
the 8255A and the CPU. It is connected to the decoded address, and A0 & A1 are connected to the
microprocessor address lines.
WR
It stands for write. This control signal enables the write operation. When this signal goes low, the
microprocessor writes into a selected I/O port or control register.
RESET
This is an active high signal. It clears the control register and sets all ports in the input mode.
¯𝑫
𝑹¯¯ -
It stands for Read. This control signal enables the Read operation. When the signal is low, the
microprocessor reads the data from the selected I/O port of the 8255.
¯𝑊
¯¯¯𝑅¯-
When this pin goes low, the processor can write or store the data into the output port of PPI.
A1, A0
These are the address lines and are connected to the LSB of the address bus of the
processor. RESET
When this is high, PPI is in reset condition and there is no data communication between ports.
Intel 8255 is used for parallel data transfer through data bus D 0-D7
30
Port C is divided into 2 sub group i.e., PC0 – PC3 (PClower)
All ports are of 8 bit. In total there are 4 ports which can be programmed according to the requirement
as input and output port.
The Intel 8255 is designed for use with Intel’s 8 bit, 16 bit and higher capability of processor
All the port of 8255 can function independently as input or output by programming the controlled word
register.
II. It is used to interface the 8255 data bus with the system data bus.
III. It is outer pin are D0- D7 and it is connected to system data bus.
IV. The direction of the data bus is to be decided by the read/ write control signal.
V. In read operation it transmits data to the system data bus. In write operation it receives data from
the system data bus.
a) This block function is to accept inputs from system control bus and address bus.
31
b) Here control signals like read, write chip select and address signals A0, A1 are used.
c) Among these 5 signals, Read and Write are connected to the address lines A0 and A1 of the system
address lines.
d) The selection of 8255 is enabled or disabled by chip select. If it is ‘0’ the 8255 is selected and if it is ‘1’,
the 8255 is rejected.
b) Group A consists of port A and Port Cupper and group B consists of port B and Port Clower.
1. The ports of 8255 PPI and Port A, Port B, Port C each port consists of an 8-bit data input buffer.
2. The function of port A, port Band Port C are decided by control bit pattern of CWR.
4. Port C pin can be used as simple I/O handshake signal and stauts signal.
A1 A0 Port/Register selection
0 0 Port A
32
0 1 Port B
1 0 Port C
1 1 CWR
33
Q. Make a control word when the ports of INTEL are defined as follow: -
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 1 1 0 0 0
Ans= 98H
Q. Make a control word of Intel 8255 for mode 0 operation and port B, Port Cupper port Clower all are
output port.
34
Direct Memory Access (DMA)
In a computer system data communication take place between I/O device and CPU and memory.
The technology involved with CPU and memory is same i.e., semiconductor technology.
The I/O devices don’t use semiconductor technology. Hence the speed of memory and I/O devices the
DMA technology is used.
The CPU does not interfere in DMA technique but it has to participate in the process through buses.
35
1. DMA channel
There are 4 channels in INTEL 8257: channel 0
Channel 1
Channel 2
Channel 3
These channels are connected to different I/O devices. Each channel has 2 registers
DMA request starts from DRQ0 and ends with DRQ3. That means at a time 4 peripheral devices can
36
send DMA request to INTEL 8257.
DRQ0 has lowest priority that means that line held high until it receives an acknowledgement from
8257.
3. DMA Acknowledgement:
A peripheral device when gives a DMA request, the DMA controller or 8257 sends acknowledgement
signal through DACK signal. As there are 4 DRQ lines so there are 4 DACK line.
When the CPU has the control over the bus then that is called “slave mode”.
IOW means the pin is used to write the data into the output device.
IOR means the pin is used to read the data into the output device.
DMA Operation
An I/O device sends request for data transfer through DRQ lines (DMA request).
When 8257 receives DRQ from an I/O device it issues a HOLD request line to the CPU.
When the processor gets HRQ request, it acknowledges through HLDA line.
37
¯¯¯𝐴¯¯𝐶¯¯𝐾¯ to the I/O devices. Now,
After receiving HLDA for processor, Intel sends 𝐷
the address is sent to the address bus and data is sent through data bus.
Ready pin is used to show that I/O devices are ready for data transfer. The data transfer
continue till the ready pin remains high.
¯𝑀¯¯𝐸
¯¯𝑀
¯¯¯𝑅
¯,̄ ¯𝑀
¯¯𝐸
¯¯𝑀 ¯¯,𝐼¯¯𝑂¯¯𝑅¯, 𝐼¯¯𝑂¯¯𝑊
¯¯¯𝑊 ¯¯ are the control signals used for data flow between memory and I/O
devices.
This chip converts parallel data into serial stream of bits and converts it into parallel byte
for the microprocessor.
38
¯¯¯𝑆¯𝑅¯- Data set Ready
𝐷
¯¯𝐶𝑇
¯¯𝑆¯- Clear to send
¯¯𝑅𝑇
¯¯𝑆¯- Request to send
39
TXC – Transmitter clock input
Operation:
The data bus buffer interface the internal bus with the system bus (processor bus)
The read/ write control logic controls the operation of the peripheral depending on the
operation of the processor. This unit is also responsible to select one of the two internal
addresses like control address and data address.
The modem control unit transmits the data byte received by the data bus buffer from
processor for serial communication. This decides the transmission rate by that signal
¯𝑇¯𝑋¯ .
C
D0-D7 It is a 8 bit data bus which is connected to the data bus of processor.
C/𝑫 ¯ - It is a control or data address. If it is high, then the address is control address and if
it is low, then it is for data address.
¯¯¯𝐷¯- When it is low, then CPU reads data from the internal resisters of 8251.
𝑅
¯𝑊
¯¯¯𝑅¯- When it is low, then CPU writes data onto 825.
CLK- It is used to generate internal device time; it should be at least 30 times greater
than transmission and reception frequency.
40
¯𝑇¯𝑋
¯¯𝑐¯- It is a transmitter clock input. It controls the rate( speed) of data transmission.
RXRDY-It is a receiver ready signal. It gives the signal to know whether the receiver is
ready to transfer the data or not.
¯¯¯𝑺¯¯𝑹¯- It is a data set Ready signal. When it is low the internal data bus is set.
𝑫
RXC- It is the receiver clk signal, that controls data rate of receiver.
TXE- It is the transmitter Empty signal. If it is high then the transmitter has has already
sent the data and there is no data left.
41
In this method the unknown analog voltage Vin is convert to digital by comparing it with
the reference voltage Vr.
For an ‘n’ bit digital input, the comparison with the reference voltage is done ‘n’ times.
If Vin > Vr or Vin > fraction of Vr then the digital bit is set to 1.
Σ[𝑏i2–i]𝑉r
n=1
bi = constant
42
43
Microprocessor (Architecture and
Programming-16 bit-8086)
Special features of Intel 8086:
✓ It is a 16-bit microprocessor.
✓ It is a 40 pin DIP.
✓ It has three clock pulses like 5 MHz, 8 MHz, and 10 GHz.
✓ It has 20-line address bus i.e., A0-A19.
✓ It has a 16-bit wide data bus i.e., D0-D7.
AD0-AD7 –
44
✓ The address bus is of 20 bits wide i.e., A0-A19.
✓ It can be grouped as lower order address line(Ao-A15) & higher order address line(A16-A19).
✓ Data bus is 16 bits wide i.e., D0-D15 to make AD0-AD15.
✓ These are bidirectional.
NMI:
INTR:
This is also an interrupt request signal that can be avoided by the processor.
RESET:
Ready: When it is high the data transfer between processor and peripheral takes place.
CLK:
Vcc:
GND
¯𝑻¯¯𝑬¯¯𝑺¯¯𝑻¯-
¯𝑩¯¯𝑯
¯¯¯𝑬¯/S7
45
• As we know, INTEL 8086 can operate in two modes i.e., minimum mode and maximum
mode.
• When MN/¯𝑴¯¯¯𝑿¯ is high, the 8086 is operated in minimum mode.
• When MN/¯𝑴¯¯¯𝑿¯ goes low the 8086 is in maximum mode.
¯𝑰¯𝑵
¯¯¯𝑻¯¯𝑨¯- It is an interrupt acknowledgement signal.
ALE- This stand for address latch enable. It is used to latch the address line into 8282 latch.
¯𝑫¯¯𝑬
¯¯𝑵
¯¯- It stands for Data Enable. When it goes low the data from data bus buffer goes to peripherals.
¯-
DT/𝑹
When it goes high the data is transmitted and when it goes low the data is received from peripheral.
M/¯𝑰¯𝑶
¯–
When it is high, the data is for memory and when it is low, the data is for IO device.
¯𝑾
¯¯¯𝑹¯-
When it goes low, the processor writes the data into the memory.
HLDA-
QS1, QS0
46
1 1 Subsequent byte from the
queue
¯𝑺¯𝟎¯¯𝑺¯¯𝟏¯𝑺¯𝟐¯-
¯¯𝑶
𝑳 ¯¯¯𝑪¯𝑲
¯¯-
It is an active low pin or signal when it goes low all the interrupt are masked and no HOLD request will
be received.
¯𝑹¯¯𝑸¯¯/̄¯𝑮¯¯𝑻¯¯¯,¯𝑹¯¯𝑸¯¯/̄𝑮
¯¯𝑻
¯¯¯ –
𝟏, 𝟎
These are bidirectional line and are request and Grant command.
¯¯𝑄
Priority of 𝑅 ¯¯O¯is more than ¯¯𝑅𝑄
¯¯1¯.
47
GPR:
BIU:
48
• It also contains instruction queue and address conversion mechanism for physical address
calculation.
• It is responsible for all external bus operation.
• It sends address by address bus , fetches the instruction, reads the data from memory and
I/O devices, also write the data into the memory and I/O device.
• Responsible for generating 20 bit address and in communication the data with the data
bus.
EU:
Pipelining:
AS the BIU and EU work independently, so the operation work becomes faster, this is called pipelining.
In this method, fetching and execution are done simultaneously.
GPR:
These 16 bit registers can be divided into lower and higher order group like:
AX- AH &AL
49
BX- BH & BL
CX- CH & CL
DX- DH & DL
H- Higher order
L- Lower Order
Segment Registers:
SP
BP
SI
DI
Stack pointer holds the address of stack top. All the register are used for memory
address computation.
Instruction pointer:
50
Flag Register:
X X X X O D I T S Z X Ac X P X Cy
T- Trap
I-Interrupt
If it is high, the CPO recognizes the maskable interrupt but if it is low the interrupt are avoided.
D- Direction
O-Overflow
If there is a bit overflow condition, in case of computation, the overflow flag is set otherwise reset.
51
✓ 8086 is operated in minimum mode by strapping its MN/¯𝑀 ¯¯𝑋¯ to logic 1
✓ In this mode a single processor is used. So, all the control signal are given by processor itself.
✓ Some extra components are latches, transceivers, clock generator, I/O device, and memory.
✓ The latches are D- flip flop and used for separating the data and address signal.
✓ The transceivers are to amplify the data and is connected by two signals DT/𝑅¯ and ¯𝐷¯¯𝐸¯¯𝑁¯.
✓ ¯𝐷¯¯𝐸¯¯𝑁¯ informs whether the data in the data bus is available or not.
52
✓ 8086 is operated in maximum mode by strapping MN/¯𝑀 ¯¯𝑋¯ to logic 0.
✓ In maximum mode, the architecture contains same blocks as in minimum mode with an extra
bus controller Intel 8288.
✓ As in maximum mode, these are more than one processor connected in cascade, so to have
control over the buses, the bus controller is used.
✓ Here the control signals ¯𝐷¯¯𝐸¯¯𝑁¯, DT/𝑅¯ are issued by Intel 8288.
✓ In this mode, the processor gives the status signals ¯𝑆¯o¯ ,𝑆¯1, 𝑆¯2 to the bus controller.
The way in which an operand is specified for an instruction, is called the addressing mode.
53
Register addressing:
In register addressing the operand is one of the 16 bit or 8 bit general purpose register.
ADD AL, BL
Immediate addressing:
Direct addressing:
In direct addressing mode, the operand’s offset is given in the instruction as an 8 bit or 16-bit
displacement element.
This instruction adds the content of the offset address 0301 to AL. The operand is placed at the given
offset o301 within the data segment DS.
The operand’s offset is placed in any one of the registers BX, BP, SI, or DI are specified in the instruction.
Indexed addressing:
The operand’s offset is the sum of the content of an index register SI or DI and an 8 bit or 16-bit
displacement.
54
MOV AX, [SI+1250]; 16-bit displacement
Based addressing:
The operand’s offset is the sum of the 8 bit or 16-bit displacement and the contents of the base register
BX or BP. BX is used as a base register for data segment and BP is used as a base register for stack
segment.
The operand’s offset is the sum of the content of a base register BX or BP and an index register SI or DI.
55
Classification of instructions of INTEL 8086:
Instructions are classified as per their basic function perform. These are categorized as: -
56
57
Reference
• The 8051 Microcontroller & Embedded Systems by Mazidi & Mazidi, - Pearson publication
58