Introduction To Microprocessor
Introduction To Microprocessor
INR r
Increment register content INR H
DCR r
Decrement register content DCR L
Logical Instructions: perform logical operation such as AND, OR, compare, rotate,
etc.
Instruction Set Explanation
ANA r
AND register with accumulator
ORA r
OR-register with accumulator
CMP r
Compare register with accumulator
RLC
Rotate accumulator left
RRC
Rotate accumulator right
Branching Instructions :T his group contains the instructions for conditional
and unconditional jump, subroutine call and return, and restart.
JC addr (label)
Jump if there is a carry
Halt and enter The CPU finishes executing the current instruction
HLT and stops further execution. An interrupt or reset is
wait state necessary to exit from the halt state.
The interrupt enable flip-flop is reset and all the
DI Disable interrupts interrupts are disabled.
The interrupt enable flip-flop is set and all the
EI Enable interrupts interrupts are enabled.
OUT port address Output data Output data from accumulator to I/O port
Addressing modes of 8085
The way of specifying data to be operated by an instruction is called
addressing mode. In 8085 microprocessor there are 5 types of
addressing modes:
• Immediate Addressing:
–Data is provided in the instruction .
–Load the immediate data to the destination provided.
–Eg: MVI A, 12 H (This loads the data 12H to the
accumulator register)
–LXI H 3050H (load the H-L register pair with the data
3050H)
• Register Addressing:
–Data is provided through the registers.
–the operation is performed within various
registers of the microprocessor.
–Example: MOV B, C
–ADD A,B
• Direct Addressing:
–the data to be operated is available inside a
memory location and that memory location is
directly specified as an operand.
–Example: MOV A, [1000]
• Indirect Addressing:
–Effective address is calculated by the processor and the
contents of the address is used to form a second
address. The second address is where the data is stored.
–Example: MOV A, [[1000]]
• Implicit addressing:
–In this addressing mode the instruction itself specifies
the data to be operated upon.(The data to be operated is
available in the instruction itself. )
–Example: CMA ; Complement the contents of
accumulator
– RRC (rotate accumulator A right by one bit)
– RLC (rotate accumulator A left by one bit)
Interrupts in 8085
Interrupts are the signals generated by the
external devices to request the microprocessor to
perform a task. OR
Interrupt is a mechanism by which an I/O or an
instruction can suspend the normal execution of
processor and get itself serviced.
There are 5 interrupt signals:
TRAP,
RST 7.5,
RST 6.5,
RST 5.5, and
INTR.
CLASSIFICATION OF INTERRUPTS:
HARDWARE AND SOFTWARE INTERRUPTS:
When microprocessors receive
interrupt signals through pins
(hardware) of microprocessor, they
are known as Hardware Interrupts.
There are 5 Hardware Interrupts in
8085 microprocessor. They are —
INTR, RST 7.5, RST 6.5, RST 5.5,
TRAP
Software Interrupts are those which
are inserted in between the program
which means these are mnemonics
of microprocessor. There are 8
software interrupts in 8085
microprocessor. They are–RST 0,
RST 1, RST 2, RST 3, RST 4, RST 5,
RST 6, RST 7.
Maskable Interrupts we can disable the interrupt by writing
some instructions into the program. example: RST7.5,
RST6.5, RST5.5.
Non-Maskable Interrupts we cannot disable the interrupt by
writing some instructions into the program. example: TRAP.
6.End
• MVI A, 8bitdata1 moves first data to accumulator
• MVI B, 8bitdata2 moves second data to register B
• ADD B add (A) and (B)
• MOV H,A copies the result present in
accumulator to register H
• MVI A,00 moves immediate data (00) to A
Algorithm
• Load both the lower and the higher bits of first
number to a register pair(say H-L)
• Load the 2nd number to another register pair (say
D-E)
• Add both the register pairs and store the result in a
memory location
• LXI H, 16bit data1 loads 16 bit data1 in
H-L register pair
• LXI D, 16bitdata2 loads 16 bit data2 in
DE register pair
• DAD D (Double Add)adds the value
of H with D and L with E
and stores the result in H
and L
• SHLD 2050 stores the result at memory
location 2050
• HLT stop
Subtraction of two 8-bit numbers
Algorithm
1.load the first data into Accumulator.
2. Load the 2nd data to a register (B register).
3.Subtract the two register contents.
5. Check for carry(borrow).
6. If borrow is present take 2's complement of
Accumulator. ( complement A and add 1)(this happens if
the first number is smaller than the second number)
7. Store the value of borrow in memory location.
8. Store the difference value present in Accumulator to a
memory location.
9. Stop
(if the 1st number is smaller than the 2nd , then the
result will be negative, hence take the 2’s compliment of
the result.)
MVI A, data1 Moves 1st number to A
SUB B [A]-[B]
SUB E [L]-[E]
HLT stop