You are on page 1of 15

SAHARSA COLLEGE OF ENGINEERING, SAHARSA

GOVT. OF BIHAR
NAME- DEEPAK KUMAR VERMA
BRANCH-ELECTRICAL ENGINEERING
ROLL NO.-2017-E-43
REG. NO.-17103132042
SUBJECT-MICROPROCESSOR

1. What is microprocessor?Differentiate between microprocessor and


microcontroller.
Ans:- Microprocessor is a controlling unit of a micro-computer, fabricated on a
small chip capable of performing ALU (Arithmetic Logical Unit) operations
and communicating with the other devices connected to it.
Microprocessor consists of an ALU, register array, and a control unit. ALU
performs arithmetical and logical operations on the data received from the
memory or an input device. Register array consists of registers identified by
letters like B, C, D, E, H, L and accumulator. The control unit controls the flow
of data and instructions within the computer.
There are a list of differences between Microprocessor and Microcontroller
:-
1. Microprocessor is a general purpose device called as CPU, whereas MCU is
a dedicated chip which is called as single chip computer.
2. An Microprocessor does not contain I/O ports, memories, Timers etc.
Microcontroller contains RAM, ROM, serial and parallel interface, Timers
(in addition to CPU) in a single chip.

1
3. Microprocessor’s are commonly used as CPU in microcomputer system,
whereas Microcontroller’s are used in minimum component design
performing control-oriented applications.
4. Microprocessor instructions are nibble(4 bits) or byte addressable,
Microcontroller instructions are both bit and byte addressable.
5. Microprocessor instruction sets are mainly intended to provide for large
amounts of data, Microcontroller sets are intended to control input and
output.
6. Microprocessor is used for designing general purpose digital computer
system, Microcontroller is used for designing Application specific systems.
7. Microprocessor design is complex and expensive, Microcontroller design is
simple and cost effective.
8. Microprocessor instruction set is complex with large no of instructions,
whereas Microcontroller has less no of instructions.
9. Microprocessor has zero status flag, whereas Microcontroller has no zero
flag.
10.Rapid movement of data between external memory and Microprocessor, In
Microcontroller movement of data and code within it.
2.Draw and discuss the architecture of 8085.
Ans:- The architecture of 8085 microprocessor mainly includes the timing & control unit,
Arithmetic and logic unit, decoder, instruction register, interrupt control, a register array, serial
input/output control. The most important part of the microprocessor is the central processing unit.

2
8085 Architecture

Operations of 8085 Microprocessor


The main operation of ALU is arithmetic as well as logical which includes addition, increment,
subtraction, decrement, logical operations like AND, OR, Ex-OR, complement, evaluation, left
shift or right shift. Both the temporary registers as well as accumulators are utilized for holding
the information throughout in the operations then the outcome will be stored within the
accumulator. The different flags are arranged or rearrange based on the outcome of the operation.

Flag Registers
The flag registers of microprocessor 8085 are classified into five types namely sign, zero,
auxiliary carry, parity and carry. The positions of bit set aside for these types of flags. After the
operation of an ALU, when the result of the most significant bit (D7) is one, then the sign flag
3
will be arranged. When the operation of the ALU outcome is zero then the zero flags will be set.
When the outcome is not zero then the zero flags will be reset.
In an arithmetic process, whenever a carry is produced with the lesser nibble, then an auxiliary
type carry flag will be set. After an ALU operation, when the outcome has an even number then
the parity flag will be set, or else it is reset. When an arithmetic process outcome in a carry, then
carry flag will be set or else it will be reset. Between the five types of flags, the AC type flag is
employed on the inside intended for BCD arithmetic as well as remaining four flags are used with
the developer to make sure the conditions of the outcome of a process.

Control and Timing Unit


The control and timing unit coordinates with all the actions of the microprocessor by the clock
and gives the control signals which are required for communication among the microprocessor as
well as peripherals.

Decoderandinstructionregister
As an order is obtained from memory after that it is located in the instruction register, and
encoded & decoded into different device cycles.

Register Array
The general purpose programmable registers are classified into several types apart from the
accumulator such as B, C, D, E, H, & L. These are utilized as 8-bit registers otherwise coupled to
stock up the l6 bit of data. The permitted couples are BC, DE & HL, and the short term W & Z
registers are used in the processor & it cannot be utilized with the developer.

Special Purpose Registers


These registers are classified into four types namely program counter, stack pointer, increment or
decrement register, address buffer or data buffer.

Program Counter
This is the first type of special purpose register and considers that the instruction is being
performed by the microprocessor. When the ALU completed performing the instruction, then the
microprocessor searches for other instruction to be performed. Thus, there will be a requirement
of holding the next instruction address to be performed in order to conserve time. Microprocessor

4
increases the program when an instruction is being performed, therefore that the program counter
position to the next instruction memory address is going to be performed…

Stack Pointer in 8085


The SP or stack pointer is a 16-bit register and functions similar to a stack, which is constantly
increased or decreased with two throughout push and pop processes.

Increment or Decrement Register


The 8-bit register contents or else a memory position can be increased or decreased with one. The
16-bit register is useful for incrementing or decrementing program counters as well as stack
pointer register content with one. This operation can be performed on any memory position or any
kind of register.

Address-Buffer & Address-Data-Buffer


Address buffer stores the copied information from the memory for the execution. The memory &
I/O chips are associated with these buses; then the CPU can replace the preferred data by I/O
chips and the memory.

Address Bus and Data Bus


The data bus is useful in carrying the related information that is to be stock up. It is bidirectional,
but address bus indicates the position as to where it must be stored & it is unidirectional, useful
for transmitting the information as well as address input/output devices.

Timing & Control Unit


The timing & control unit can be used to supply the signal to the 8085 microprocessor for
achieving the particular processes. The timing and control units are used to control the internal as
well as external circuits. These are classified into four types namely control units like RD’ ALE,
READY, WR’, status units like S0, S1, and IO/M’, DM like HLDA, and HOLD unit, RESET
units like RST-IN and RST-OUT.

3.Draw the pin diagram of 8085.

Ans:-

5
4.What are the various registers in 8085?Discuss their functions.

Ans:-A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that


reads binary instructions from a storage device called memory, accepts binary data as input and processes data
according to those instructions and provide results as output. A 8085
microprocessor, is a second generation 8-bit microprocessor and is the base for studying and using all the
microprocessor available in the market.

Registers in 8085:

(a) General Purpose Registers –

The 8085 has six general-purpose registers to store 8-bit data; these are identified as- B, C, D, E, H, and L.
These can be combined as register pairs – BC, DE, and HL, to perform some 16-bit operation. These registers
are used to store or copy temporary data, by using instructions, during the execution of the program.

(b) Specific Purpose Registers –

• Accumulator:
The accumulator is an 8-bit register (can store 8-bit data) that is the part of the arithmetic and
logical unit (ALU). After performing arithmetical or logical operations, the result is stored in
accumulator. Accumulator is also defined as register A.  Flag registers:

6
• The flag register is a special purpose register and it is completely different from other registers in
microprocessor. It consists of 8 bits and only 5 of them are useful. The other three are left vacant and
are used in the future Intel versions.These 5 flags are set or reset (when value of flag is 1, then it is
said to be set and when value is 0, then it is said to be reset) after an operation according to data
condition of the result in the accumulator and other registers. The 5 flag registers are:

• Sign Flag: It occupies the seventh bit of the flag register, which is also known as the most significant
bit. It helps the programmer to know whether the number stored in the accumulator is positive or
negative. If the sign flag is set, it means that number stored in the accumulator is negative, and if
reset, then the number is positive.
• Zero Flag:: It occupies the sixth bit of the flag register. It is set, when the operation performed in the
ALU results in zero(all 8 bits are zero), otherwise it is reset. It helps in determining if two numbers
are equal or not.
• Auxillary Carry Flag: It occupies the fourth bit of the flag register. In an arithmetic operation, when a
carry flag is generated by the third bit and passed on to the fourth bit, then Auxiliary Carry flag is set.
If not flag is reset. This flag is used internally for BCD(BinaryCoded decimal Number) operations.
Note – This is the only flag register in 8085 which is not accessible by user.
• Parity FlagL: It occupies the second bit of the flag register. This flag tests for number of 1’s in the
accumulator. If the accumulator holds even number of 1’s, then this flag is set and it is said to even
parity. On the other hand if the number of 1’s is odd, then it is reset and it is said to be odd parity.
• Carry Flag: It occupies the zeroth bit of the flag register. If the arithmetic operation results in a
carry(if result is more than 8 bit), then Carry Flag is set; otherwise it is reset.
(c) Memory Registers –

There are two 16-bit registers used to hold memory addresses. The size of these registers is 16 bits because the
memory addresses are 16 bits. They are :-

• Program Counter: This register is used to sequence the execution of the instructions. The function of the
program counter is to point to the memory address from which the next byte is to be fetched. When a
byte (machine code) is being fetched, the program counter is incremented by one to point to the next
memory location.
• Stack Pointer: It is used as a memory pointer. It points to a memory location in read/write memory,
called the stack. It is always incremented/decremented by 2 during push and pop operation.

7
o
Sign Flag (7th bit): It is reset(0), which means number stored in the accumulator is positive.
o Zero Flag (6th bit): It is reset(0), thus result of the operations performed in the ALU is nonzero.
o Auxiliary Carry Flag (4th bit): We can see that b3 generates a carry which is taken by b4, thus auxiliary
carry flag gets set (1).
o Parity Flag (2nd bit): It is reset(0), it means that parity is odd. The accumulator holds odd number of 1’s.
o Carry Flag (0th bit): It is set(1), output results in more than 8 bit.

5.In 8085 name the 16 bit registers?

Ans:-Stack pointer and Program counter all have 16 bits.

6.Explain the various flags used in 8085?

1) The carry flag(CF):-

This flag is set whenever there has been a carry out of, or a borrow into, the higher order bit of the result.
The flag is used by the instructions that add amd subtract multibyte numbers.

1-carry out from MSB bit on addition or borrow into MSB bit on subtraction
0-no carry out or borrow into MSB bit
2) The parity flag(PF):-

8
This flag is set whenever the result has even parity, an even number of 1 bits. If parity is odd, PF is cleared.
1-low byte has even number of 1 bits
0-low byte has odd parity
3) The auxiliary carry flag(AF):-
This flag is set whenever there has been a carry out of the lower nibble into the higher nibble or a borrow
from higher nibble into the lower nibble of an 8 bit quantity, else AF is reset. This flag is used by decimal
arithmetic instructions.
1-carry out from bit 3 on addition or borrow into bit 3 on subtraction
0-otherwise
4) The zero flag(ZF):-
This flag is set, when the result of operation is zero, else it is reset.
1-zero result
0-non-zero result
5) The sign flag(SF):-
This flag is set, when MSB (Most Significant Bit) of the result is 1. Since negative binary numbers are
represented in the 8085 CPU in standard two’s complement notation, SF indicates sign of the result.

7.What is Stack pointer?


Ans:-A stack pointer is a small register that stores the address of the last program request in a
stack. A stack is a specialized buffer which stores data from the top down. As new requests come
in, they "push down" the older ones. The most recently entered request always resides at the top
of the stack, and the program always takes requests from the top.

A stack (also called a pushdown stack) operates in a last-in/first-out sense. When a new data item
is entered or "pushed" onto the top of a stack, the stack pointer increments to the next physical
memory address, and the new item is copied to that address. When a data item is "pulled" or
"popped" from the top of a stack, the item is copied from the address of the stack pointer, and the
stack pointer decrements to the next available item at the top of the stack.

8.What is Program counter?


Ans:-A program counter is a register in a computer processor that contains the address (location) of the
instruction being executed at the current time. As each instruction gets fetched, the program counter increases
its stored value by 1.

Program counter(PC) , also called instruction pointer .

9
A branch provides that the next instruction is fetched from somewhere else in memory. A subroutine call not
only branches but saves the preceding contents of the PC somewhere. A return retrieves the saved contents of
the PC and places it back in the PC, resuming sequential execution with the instruction following the
subroutine call.

A program counter is also known as an instruction counter, instruction pointer, instruction address register or
sequence control register.

It is a digital counter needed for faster execution of tasks as well as for tracking the current execution point.

9.What is meant by a bus?Explain different types of buses.


Ans:-BUS : In computing, a bus is defined as a set of physical connections (Cables, Printed circuits, etc.),
which can be shared by multiple hardware components in order to communicate with one another.

All computers have three fundamental buses: Control, Data and Address bus.

Control Bus: The motherboard's control bus manages the activity in the system. The control bus, like the other
buses, is simply a set of connections among the parts in the computer.
Data Bus: The data bus acts as a conduit for data from the keyboard, memory and other devices. It passes
information at speeds up to billions of characters per second. The central processor reads the data, performs
calculations, and moves new data back to memory, the hard drive and other locations.

Address Bus: The computer must be able to access every character of memory rapidly, so every character has
its own address number. The central processor specifies which addresses it wants to read or write and the
address bus carries this information to a memory controller circuit, which locates and fetches the information.

10.Give the brief view about interrupts of 8085?


 TRAP
It is a non maskable interrupt, both edge and level triggered interrupt, having the highest priority among all
interrupts. By default, it is enabled until it gets acknowledged. In case of failure, it executes as ISR and sends
the data to backup memory. This interrupt transfers the control to the location 0024H.

 RST7.5
It is a maskable interrupt, level triggered having the second highest priority among all interrupts. When this
interrupt is executed, the processor saves the content of the PC register into the stack and branches to 003CH
address.

 RST 6.5
It is a maskable interrupt, level triggered having the third highest priority among all interrupts. When this
interrupt is executed, the processor saves the content of the PC register into the stack and branches to 0034H
address.

 RST 5.5
It is a maskable interrupt level triggered. When this interrupt is executed, the processor saves the content of the
PC register into the stack and branches to 002CH address.

10
 INTR
It is a maskable interrupt, level triggered having the lowest priority among all interrupts. It can be disabled by
resetting the microprocessor.

11.Name 5 different addressing modes and explain it?


Types of addressing modes –
In 8085 microprocessor there are 5 types of addressing modes:
1. Immediate Addressing Mode –
In immediate addressing mode the source operand is always data. If the data is 8-bit, then the
instruction will be of 2 bytes, if the data is of 16-bit then the instruction will be of 3 bytes.

Examples:
MVI B 45 (move the data 45H immediately to register B)
LXI H 3050 (load the H-L pair with the operand 3050H immediately)
JMP address (jump to the operand address immediately)
2. Register Addressing Mode –
In register addressing mode, the data to be operated is available inside the register(s) and register(s)
is(are) operands. Therefore the operation is performed within various registers of the microprocessor.
Examples:
MOV A, B (move the contents of register B to register A)
ADD B (add contents of registers A and B and store the result in register A) INR A
(increment the contents of register A by one)
3. Direct Addressing Mode –
In direct addressing mode, the data to be operated is available inside a memory location and that
memory location is directly specified as an operand. The operand is directly available in the
instruction itself.
Examples:
LDA 2050 (load the contents of memory location into accumulator A)
LHLD address (load contents of 16-bit memory location into H-L register pair)
IN 35 (read the data f rom port
whose address is 01)
4. Register Indirect Addressing Mode –
IN register indirect addressing mode, the data to be operated is available inside a memory location
and that memory location is indirectly specified b a register pair.
Examples:
MOV A, M (move the contents of the memory location pointed by the H-L pair to the accumulator)
LDAX B (move contains of B-C register to the accumulator)
LXIH 9570 (load immediate the H-L pair with the address of the location 9570)
5. Implied/Implicit Addressing Mode –
In implied/implicit addressing mode the operand is hidden and the data to be operated is available in
the instruction itself.
Examples:
CMA (finds and stores the 1’s complement of the contains of accumultor A in A)
RRC (rotate accumulator A right by one bit)
RLC (rotate accumulator A left by one bit)

12.What is clock frequency for 8085 ? Why crystal is preferred clock source?
11
Ans:-3 MHz is the maximum clock frequency for 8085. Crystal
is a preferred clock
source because of high stability, large Quality Factor & the frequency
that doesn’t drift with aging. Crystal is used as a clock source most of
the times.
13.Difference between SRAM and DRAM?

14.What is the difference between primary and secondary storage device?

12
15.Draw the timming diagram for Opcode fetch, memory read, memory write, I/O
read, I/O write.

Fig: Opcode fetch timing diagram

13
Memory read timing diagram

Memory write timing diagram

I/O read timing diagram

I/
O write timing diagram

14
16.Draw the timing diagram for
a)MOV A, B

Fig: Timing Diagram for MOV A,B

15

You might also like