Unit 2 Final
Unit 2 Final
Unit 2 Final
1 a) Draw the pin diagram of the 8085 microprocessor and categorize the pins based on
function. [L4] [CO2] [8M]
The DMA Controller issued the Hold signal to the μP. In response the μP releases the System
bus.
After releasing the system bus the μP acknowledges the Hold signal with HLDA signal.
iv) TRAP
A non-maskable interrupt is a Trap interrupt which implies that whenever this pin gets activated,
the 8085 always gets interrupted even if the stat of 8085 is in DI. The input of Trap input is level
sensitive and edge sesitive.
2. a) Define an interrupt and explain the different types of interrupts available in the 8085
microprocessors. [L2] [CO2] [6M]
Interrupt is a signal emitted by hardware or software when a process or an event needs
immediate
attention. It alerts the processor to a high priority process requiring interruption of the current
working
process. In I/O devices one of the bus control lines is dedicated for this purpose and is called the
Interrupt
Service Routine (ISR).
2. RST 7.5
3. RST 6.5
4. RST 5.5
5. INTR
TRAP:
This is an edge as well as level triggered, vectored interrupt.
RST 7.5
This is an edge triggered, vectored interrupt.
RST 6.5
This is a level triggered, vectored interrupt.
RST 5.5
This is a level triggered, vectored interrupt.
INTR:
This is a level triggered, non-vectored interrupt.
Hardware INTA:
This is an acknowledgement signal for INTR (only).
This signal is used to get the Op-Code (and hence the ISR address) from External hardware
Step 2: The control unit sends he control signal to enable the memory chip The control signal is
sent out during the clock period T2, thus enabling the memory chip. The is active during two clock
periods.
Step 3: The byte from the memory location is placed on the data bus. When the memory is enabled, the
instruction byte (4FH) is placed on the busAD7 - AD0 and transferred to the microprocessor. The
signal causes 4FH to be placed on bus AD7-AD0 (shown by the arrow), and when goes high, it
causes the bus to go into high impedance.
Step 4: The byte is placed in the instruction decoder of the microprocessor, and the task is carried out
according to the instruction. The machine code or the byte (4FH) is decoded by the instruction decoder,
and the contents of the accumulator are copied into register C. This task is performed during the period T 4
in Figure.2
4 a) With a neat sketch and explain, the De-multiplexing of the Bus AD7- AD0 in 8085.
[L3][CO3] [6M]
The address in 8085 contains 16 bits, and data contains 8 pins, needs 24 pins in IC to be used
as address and data pins, rather than this designer as a different approach to reduce the usage of
pins for address & data. Only 16pins are used totally for address and data, in which 8 pins (AD 0
-AD 7) are combined, used to generate address & data.
Microprocessor generates both data & addresses one same 8 pins. The thing is to resolve both
address & data from these pins. This process is achieved through de multiplexing the address &
data signals
b) Illustrate the generating control signal in 8085 Microprocessor. [L2] [CO2] [6M]
Timing and control unit is a very important unit as it synchronizes the registers and flow of data through
various registers and other units.
This unit consists of an oscillator and controller sequencer which sends control signals needed for
internal and external control of data and other units.
The oscillator generates two-phase clock signals which aids in synchronizing all the registers of 8085
microprocessor.
We use Timing and Controlling unit in 8085 for the generation of timing signals and the signals to
control. All the operations and functions both interior and exterior of a microprocessor are controlled by
this unit.
READY: It is used to sense whether the peripheral is ready or not for data transfer, If it is not ready, the
processor waits. Thus it is used to synchronize slower peripherals.
Address latch enable (ALE) : It is used to separate multiplexed address and data
bus.S0 & S1: It indicates the type of machine cycle in progress.
RESET Signals: RESETIN’ –Sets the PC to Zero and clears the INTE flag. RESET OUT–It is used to
reset other devices connected externally.
DMA Signals: HOLD–This signal indicates that another master is requesting to use address bus, data
and control bus. HLDA–It is used to acknowledge HOLD request.
RD: Read (active low). To indicate that the I/O or memory selected is to be read and data are available
on the bus.
WR: Write( Active low). This is to indicate that the data available on the bus are to be written tomemory
or I/O ports.
IO/M’: To differentiate I/O operation of memory operations. –‘0’ - indicates a memory operation.
–‘1’- indicates an I/O operation. IO/M’ combined with RD’ and WR’ to generate I/O and memorycontrol
sig
Fig- Generation of control signals
5 a) Sketch neat the block diagram of 8085 Architecture and explain the function of each
block. [L3] [CO3] [8M]
Accumulator
It is an 8-bit register used to perform arithmetic, logical, I/O & LOAD/STORE operations. It is connected
to internal data bus & ALU.
Arithmetic and logic unit
As the name suggests, it performs arithmetic and logical operations like Addition, Subtraction, AND, OR,
etc. on 8-bit data.
Parity (P)
Carry (C)
D7 D6 D5 D4 D3 D2 D1 D0
S Z - AC - P - CY
Interrupt control
As the name suggests it controls the interrupts during a process. When a microprocessor is executing a
main program and whenever an interrupt occurs, the microprocessor shifts the control from the main
program to process the incoming request. After the request is completed, the control goes back to the
main program.
There are 5 interrupt signals in 8085 microprocessors: INTR, RST 7.5, RST 6.5, RST 5.5, TRAP.
Serial Input/output control
It controls the serial data communication by using these two instructions: SID (Serial input data) and
SOD (Serial output data).
Address buffer and address-data buffer
The content stored in the stack pointer and program counter is loaded into the address buffer and address-
data buffer to communicate with the CPU. The memory and I/O chips are connected to these buses; the
CPU can exchange the desired data with the memory and I/O chips.
Address bus and data bus
Data bus carries the data to be stored. It is bidirectional, whereas address bus carries the location to where
it should be stored and it is unidirectional. It is used to transfer the data & Address I/O devices.
2. Special purpose – Accumulator, Flag Register, Program Counter (PC), Stack Pointer (SP)
FLAG REGISTER
The 8085 has five flags to indicate five different types of data conditions. They are Zero (Z),
Carry (CY), Sign (S), Parity (P), and Auxiliary Carry (AC) flags. The most commonly used flags
arc Sign, Zero, and Carry. These flags have critical importance in the decision-making process of
the microprocessor
6 a) Explain the functions of a program counter, stack pointer & ALU in 8085 µP.
[L2] [CO2] [6M]
Program Counter (PC):
Program is a sequence of instructions. Microprocessor fetches these instructions from the
memory andexecutes them sequentially. The program counter is a special purpose register which,
at a given time, stores the address of the next instruction to be fetched. Program counter acts as a
pointer to the next instruction.
register pair contents will get modified. POP Operation in the Stack: Stack’s top location
contents are replicated into stack lower register (C in BC). Then SP gets increased by 1. Then the
contents of stack location as shown by SP are replicated into stack’s higher register. Now, SP is
increased by 1.
It also performs logical operations like AND, OR, EX-OR NOT etc.
The output of most of the ALU operations is stored back into the Accumulator.
b) Draw the flag register of the 8085 microprocessor and explaineach bit in detail.
[L2] [CO2] [6M]
The Flag register is a Special Purpose Register. Depending upon the value of result after any
arithmetic and logical operation the flag bits become set (1) or reset (0). In 8085microprocessors,
flag register consists of 8 bits and only 5 of them are useful.
Sign Flag (S): After any operation if the MSB [B(7)] of the result is 1, it indicates the number is
negative and the sign flag becomes set, i.e. 1. If the MSB is 0, it indicates the number is positive
and the sign flag becomes reset i.e.0.from 00H to 7F, sign flag is 0 from 80H to FF, sign flag is 1
1- MSB is 1 (negative) and 0- MSB is 0 (positive)
Example:
MVI A 30 (load 30H in register A) MVI B 40 (load 40H in register B) SUB B (A = A – B)
These set of instructions will set the sign flag to 1 as 30 – 40 is a negative number. MVI A 40
(load 40H in register A) MVI B 30 (load 30H in register B) SUB B (A = A – B) These set of
instructions will reset the sign flag to 0 as 40 – 30 is a positive number.
Zero Flag (Z): After any arithmetical or logical operation if the result is 0 (00)H, the zero flag
becomes set i.e. 1, otherwise it becomes reset i.e. 0.
00H zero flag is 1, from 01H to FFH zero flag is 0 1 for zero result and 0 for non-zero result
Example:
Example:
This instruction will set the parity flag to 1 as the BCD code of 05H is 00000101, which contains
even number of ones i.e. 2.
Carry Flag (CY): Carry is generated when performing n bit operations and the result is more
than n bits, then this flag becomes set i.e. 1, otherwise it becomes reset i.e. 0.
During subtraction (A-B), if A>B it becomes reset and if (A<B) it becomes set. Carry flag is also
called borrow flag. 1-carry out from MSB bit on addition or borrow into MSB bit on subtraction
0-no carry out or borrow into MSB bit
Example:
These set of instructions will reset the sign flag to 0 as 40 – 30 does not generate any
carry/borrow
7 a) List out the instruction sets, Explain the instruction sets withexamples.
[L2][CO2] [6M]
Instruction Formats:
Each instruction (instruction format) is of two parts. One is task to be performed, called the
operation code or opcode and the second one is the data to be operated on, called the operand.
The operands or data can be specified in different ways. It may include an 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.
ONE-BYTE INSTRUCTIONS
A one-byte instruction includes a opcode and a operand in the same byte. Operand(s) are internal
registers and are in the instruction in form of codes. If there is no numeral present in the
instruction then that instruction will be of one-byte, for example, MOV C, A, RAL, and ADD B,
etc.
TWO-BYTE INSTRUCTIONS
In a two-byte instruction, the first byte specifies the operation code and second byte specifies the
operand. Source operand is a data byte and immediately following the opcode. If an 8-bit
numeral is present in the instruction, then that instruction will be of two-byte. Here, the numeral
may be a data or an address. For example, in MVI A, 35H and IN 29H, etc.
In a two- byte instruction, the first byte will be the opcode and the second byte will be for the
numeral present in the instruction.
THREE-BYTE INSTRUCTIONS
In a three-byte instruction, the first byte specifies the opcode, and the following two bytes
specify the 16-bit operand. The second byte is the low-order operand and the third byte is the
high-order operand. If a 16-bit numeral is present in the instruction, then that instruction will be
of three-byte. Here, the numeral may be a data or an address, for example, in LXI H,3500H and
STA 2500H.
There are 4 categories of the ROTATE instruction: Rotate accumulator left (RLC), Rotate
accumulator left through carry (RAL), Rotate accumulator right (RRC), Rotate accumulator right
through carry (RAR). Among these four instructions; two are for rotating left and two are for
rotating right.
In 8085 Instruction set, RAR stands for “Rotate Accumulator Right involving Cy flag in
rotation”. It rotates the Accumulator contents to the right by 1-bit position. From the following
Fig. we are getting the operation details.
Rotate accumulator left through carry (RAL) – In this instruction, each bit is shifted to the
adjacent left position. Bit D7 becomes the carry bit and the carry bit is shifted into D0. Carry flag CY
is modified according to the bit D7.For example:
A = D7 D6 D5 D4 D3 D2 D1 D0
//before the instruction
A = 10101010; CY=0
//after 1st RAL
A = 01010100; CY=1
//after 2nd RAL
A = 10101001; CY=0
Rotate accumulator left (RLC) –
In this instruction, each bit is shifted to the adjacent left position. Bit D7 becomes D0. Carry flag
CY is
modified according to the bit D7.
For example: -
A = D7 D6 D5 D4 D3 D2 D2 D0
//before the instruction
A = 10101010; CY=0
//after 1st RLC
A = 01010101; CY=1
//after 2nd RLC
A = 10101010; CY=0
Rotate accumulator right (RRC) –
In this instruction, each bit is shifted to the adjacent right position. Bit D7 becomes D0. Carry
flag CY is
modified according to the bit D0.
For example:
A = D7 D6 D5 D4 D3 D2 D2 D0
//before the instruction
A = 10000001; CY=0
//after 1st RRC
A = 11000000; CY=1
//after 2nd RRC
A = 01100000; CY=0
9 a) Explain the Arithmetic instructions of the 8085 microprocessor
[L2] [CO2] [6M]
b) Explain the branch control instructions of the 8085 microprocessor
[L2] [CO2] [6M]
Branching instructions refer to the act of switching execution to a different instruction
sequence as a result of executing a branch instruction.
The three types of branching instructions are:
1. Jump Instructions – The jump instruction transfers the program sequence to the memory
address given in the operand based on the specified flag. Jump instructions are 2 types:
Unconditional Jump Instructions and Conditional Jump Instructions.
(a) Unconditional Jump Instructions: Transfers the program sequence to the
described memory address.
2. Call Instructions – The call instruction transfers the program sequence to the memory
address given in the operand. Before transferring, the address of the next instruction after
CALL is pushed onto the stack. Call instructions are 2 types: Unconditional Call Instructions
and Conditional Call Instructions.
(a) Unconditional Call Instructions: It transfers the program sequence to the memory
address given in the operand.
(b) Conditional Call Instructions: Only if the condition is satisfied, the instructions executes.
3. Return Instructions – The return instruction transfers the program sequence from the
subroutine to the calling program. Return instructions are 2 types: Unconditional Jump
Instructions and Conditional Jump Instructions.
(a) Unconditional Return Instruction: The program sequence is transferred unconditionally
from the subroutine to the calling program.
.DATA STORAGE