SlideShare a Scribd company logo
1 of 161
Download to read offline
Introduction
to
8085 Microprocessor
By
Prof. K. Adisesha (Ph. D)
Prof. K. Adisesha 2
8085 INTRODUCTION
Learning Objective:
➢Basic Concept and Ideas about Microprocessor.
➢Architecture of 8085
➢Addressing Modes and Instruction set of 8085
➢Interrupts of 8085
➢Peripheral Interfacings
Prof. K. Adisesha 3
Basic of Microprocessors
Differences between:
➢Microcomputer –a computer with a microprocessor as its
CPU. Includes memory, I/O etc.
➢Microprocessor –silicon chip which includes ALU, register
circuits & control circuits.
➢Microcontroller –silicon chip which includes microprocessor,
memory & I/O in a single package.
Basic of Microprocessors
Prof. K. Adisesha 4
:
Prof. K. Adisesha 5
Basic of Microprocessors
Definition of the Microprocessor:
➢ The microprocessor is a programmable device that takes in
numbers, performs on them arithmetic or logical operations
according to the program stored in memory and then produces
other numbers as a result.
❖ Programmable device: The microprocessor can perform different sets of operations
on the data it receives depending on the sequence of instructions supplied in the
given program. By changing the program, the microprocessor manipulates the data
in different ways.
❖ Instructions: Each microprocessor is designed to execute a specific group of
operations. This group of operations is called an instruction set. This instruction set
defines what the microprocessor can and cannot do.
Prof. K. Adisesha 6
Basic of Microprocessors
Inside The Microprocessor:
➢ Internally, the microprocessor is made up of 3 main units.
❖ The Arithmetic/Logic Unit (ALU)
❖ The Control Unit.
❖ An array of registers for holding data while it is being manipulated.
Prof. K. Adisesha 7
Basic of Microprocessors
Memory:
➢ Memory stores information such as instructions and data in binary
format (0 and 1). It provides this information to the microprocessor
whenever it is needed.
➢ Memory Map and Addresses.
❖ The registers inside the microprocessor
❖ Read Only Memory (ROM)
❖ Random Access Memory (RAM)
Prof. K. Adisesha 8
8085 INTRODUCTION
8085 MP Architecture:
➢ 8-bit general purpose μp
➢ Capable of addressing 64 k of memory
➢ Has 40 pins
➢ Requires +5 v power supply
➢ Can operate with 3 MHz clock
➢ 8085 upward compatible
Prof. K. Adisesha 9
8085 INTRODUCTION
The features of INTEL 8085 are :
➢It is an 8 bit processor.
➢It is a single chip N-MOS device with 40 pins.
➢It has multiplexed address and data bus.(AD0-AD7).
➢It works on 5 Volt dc power supply.
➢The maximum clock frequency is 3 MHz while minimum
frequency is 500kHz.
➢It provides 74 instructions with 5 different addressing modes.
Prof. K. Adisesha 10
The features of INTEL 8085 are :
➢It provides 16 address lines so it can access 2^16 =64K bytes of
memory.
➢It generates 8 bit I/O address so it can access 2^8=256 input ports.
➢It provides 5 hardware interrupts: TRAP, RST 5.5, RST 6.5, RST
7.5,INTR.
➢It provides Acc ,one flag register ,6 general purpose registers and
two special purpose registers(SP,PC).
➢It provides serial lines SID ,SOD. So serial peripherals can be
interfaced with 8085 directly.
8085 INTRODUCTION
Prof. K. Adisesha 11
PIN DIAGRAM -8085
Prof. K. Adisesha 12
PIN DIAGRAM -8085
➢ READY:This an output signal used to check the status of output
device.If it is low, µP will WAIT until it is high.
➢ TRAP:It is an Edge triggered highest priority , non mask able
interrupt. After TRAP, restart occurs and execution starts from
address 0024H.
➢ RST5.5,6.5,7.5:These are maskable interrupts and have low
priority than TRAP.
➢ INTR¯&INTA:INTR is a interrupt request signal after which µP
generates INTA or interrupt acknowledge signal.
➢ IO/M¯:This is output pin or signal used to indicate whether 8085
is working in I/O mode(IO/M¯=1) or Memory mode(IO/M¯=0 ).
Prof. K. Adisesha 13
PIN DIAGRAM -8085
➢ HOLD&HLDA:HOLD is an input signal .When µP receives HOLD
signal it completes current machine cycle and stops executing next
instruction. In response to HOLD µP generates HLDA that is HOLD
Acknowledge signal.
➢ RESET IN¯:This is input signal. When RESET IN¯ is low µp restarts
and starts executing from location 0000H.
➢ SID: Serial input data is input pin used to accept serial 1 bit data .
➢ X1X2 :These are clock input signals and are connected to external
LC,or RC circuit. These are divide by two so if 6 MHz is connected
to X1X2, the operating frequency becomes 3 MHz.
➢ VCC&VSS: Power supply VCC=+ -5Volt& VSS=-GND reference.
Prof. K. Adisesha 14
PIN DIAGRAM -8085
Prof. K. Adisesha 15
ARCHITECTURE-8085
Accumulator: It is 8 bit general purpose register.
◦ It is connected to ALU.
◦ So most of the operations are done in Acc.
Temporary register: It is not available for user
◦ All the arithmetic and logical operations are done in the temporary
register but user can’t access it.
Flag: It is a group of 5 flip flops used to know status of various
operations done.
◦ The Flag Register along with Accumulator is called PSW or
Program Status Word.
Prof. K. Adisesha 16
Arithmetic and Logical group
Flag Register is given by:
▪ S: Sign flag is set when result of an operation is negative.
▪ Z: Zero flag is set when result of an operation is 0.
▪ Ac: Auxiliary carry flag is set when there is a carry out of lower
nibble or lower four bits of the operation.
▪ CY: Carry flag is set when there is carry generated by an
operation.
▪ P: Parity flag is set when result contains even number of 1’s.
Rest are don’t care flip flops.
S Z X AC X P X CY
Prof. K. Adisesha 17
Arithmetic and Logical group
Prof. K. Adisesha 18
Register Group
▪ Temporary registers (W,Z):These are not available for user.
These are loaded only when there is an operation being
performed.
▪ General purpose: There are six general purpose registers in
8085 namely B, C, D, E, H, L. These are used for various
data manipulations.
▪ Special purpose :There are two special purpose registers in
8085:
▪ SP :Stack Pointer.
▪ PC: Program Counter.
Prof. K. Adisesha 19
Register Group
➢ Stack Pointer: Whenever stack is to be used previous values are
PUSHED on stack and then after the program is over these values
are POPED back.
➢ Program Counter: It is 16 bit register used to point the location from
which the next instruction is to be fetched.
➢ Instruction register: When an instruction is fetched , it is executed in
instruction register. This register takes the Opcode value only.
➢ Instruction decoder: It decodes the instruction from instruction
register and then to control block.
➢ Timing and control: This is the control section of µP. It accepts clock
input .
Prof. K. Adisesha 20
Register Group
INTERRUPT CONTROL
 It accepts different interrupts like TRAP INT5.5, 6.5, 7.5 and
INTR.
SERIAL IO CONTROL GROUP
 It is used to accept the serial 1 bit data by using SID and SOD
signals and it can be performed by using SIM & RIM
instructions.
Prof. K. Adisesha 21
DECODER & CONTROL
Prof. K. Adisesha 22
Basic of Microprocessors
Machine Language:
➢ The number of bits that form the “word” of a microprocessor is fixed for
that particular processor.
➢ These bits define a maximum number of combinations.
❖ For example an 4-bit microprocessor can have at most 24=16 different combinations.
➢ The 8085 (from Intel) is an 8-bit microprocessor.
❖ The 8085 uses a total of 246 bit patterns to form its instruction set.
❖ These 246 patterns represent only 74 instructions.
❖ The reason for the difference is that some (actually most) instructions have multiple
different formats.
➢ Because it is very difficult to enter the bit patterns correctly, they are
usually entered in hexadecimal instead of binary
Prof. K. Adisesha 23
Basic of Microprocessors
Assembly Language:
➢ Entering the instructions using hexadecimal is quite easier than entering
the binary combinations. but it still is difficult to understand what a
program written in hexadecimal does.
➢ So, each company defines a symbolic code for the instructions.
❖ These codes are called “mnemonics”.
❖ The mnemonic for each instruction is usually a group of letters that suggest the
operation performed..
➢ Example:
❖ 00111100 translates to 3C in hexadecimal (OPCODE)
❖ Its mnemonic is: “INR A”.
❖ INR stands for “increment register” and A is short for accumulator.
Prof. K. Adisesha 24
Basic of Microprocessors
:
Prof. K. Adisesha 25
Basic of Microprocessors
:
Prof. K. Adisesha 26
Basic of Microprocessors
:
Prof. K. Adisesha 27
Instruction Cycle
To execute a program:
➢ The user enters its instructions in binary format into the memory. The
microprocessor then reads these instructions and whatever data is
needed from memory, executes the instructions and places the results
either in memory or produces it on an output device.
➢ To execute a program, the microprocessor “reads” each instruction from
memory, “interprets” it, then “executes” it.
➢ To use the right names for the 3 cycles:
❖Instruction Fetch Cycle
❖Instruction Decode Cycles
❖Instruction executes Cycle
➢ This sequence is continued until all instructions are performed.
Prof. K. Adisesha 28
Instruction Cycle
To execute a program:
➢ To use the right names for the 3 cycles:
❖Instruction Fetch Cycle:
▪ The content of the PC, which is the address memory puts the opcode on the data bus so as to
transfer it to the CPU.
▪ The whole operation of fetching an opcode takes three clock cycles.
❖Instruction Decode Cycles:
▪ The opcode fetched from the memory goes to the DR and then to IR. From the IR it goes to the
decoder circuitry which decodes the instruction.
❖Instruction executes Cycle:
▪ After the instruction is decoded, execution begins.
▪ The time taken in decoding and execution of an instruction is one clock cycle
➢ This sequence is continued until all instructions are performed.
➢ The µP operates with reference to clock signal. The rise and
fall of the pulse of the clock gives one clock cycle.
➢ Each clock cycle is called a T state and a collection of
several T states gives a machine cycle.
➢ Important machine cycles are :
1. Op-code fetch.
2. Memory read.
3. Memory write.
4. I/Op-read.
5. I/O write.
Prof. K. Adisesha 29
TIMING AND STATE DIAGRAM
Basic parameters used Control signal are:
➢ ALE: ALE indicates the availability of a valid address on the multiplexed address/data
lines. When it is high or 1, then it acts as an address bus and when low or 0, then it acts
as a data bus.
➢ RD (low active): If it is high or 1, then no data is read by the microprocessor. If signal is
low or 0, then data is read by the microprocessor.
➢ WR (low active): If it is high or 1, then no data is written by the microprocessor. If signal
is low or 0, then data is written by the microprocessor.
Prof. K. Adisesha 30
TIMING AND STATE DIAGRAM
➢ IO/M (low active): A high or 1 on this signal
indicates I/O operation while a low or 0
indicates memory operation.
➢ S0, S1: S0 and S1 Indicate the type of
machine cycle in progress.
Op-code Fetch: It basically requires 4 T states from T1-T4
➢ The ALE pin goes high at first T state always.
➢ AD0-AD7 are used to fetch OP-code and store the lower byte of
Program Counter.
➢ A8-A15 store the higher byte of the Program Counter while IO/M¯
will be low since it is memory related operation.
➢ RD¯ will only be low at the Op-code fetching time.
➢ WR¯ will be at HIGH level since no write operation is done.
➢ S0=1,S1=1 for Op-code fetch cycle.
Prof. K. Adisesha 31
TIMING AND STATE DIAGRAM
Op-code fetch cycle :
Prof. K. Adisesha 32
TIMING AND STATE DIAGRAM
Memory Read Cycle:
Prof. K. Adisesha 33
TIMING AND STATE DIAGRAM
Memory Write Cycle:
Prof. K. Adisesha 34
TIMING AND STATE DIAGRAM
Memory Read Cycle: It basically requires 3T states from T1-T3
➢ The ALE pin goes high at first T state always.
➢ AD0-AD7 are used to fetch data from memory and store the
lower byte of address.
➢ A8-A15 store the higher byte of the address while IO/M¯
will be low since it is memory related operation.
➢ RD¯ will only be low at the data fetching time.
➢ WR¯ will be at HIGH level since no write operation is done.
➢ S0=0,S1=1 for Memory read cycle.
Prof. K. Adisesha 35
TIMING AND STATE DIAGRAM
Memory write Cycle: It basically requires 3T states from T1-T3 .
➢ The ALE pin goes high at first T state always.
➢ AD0-AD7 are used to fetch data from CPU and store the lower
byte of address.
➢ A8-A15 store the higher byte of the address while IO/M¯ will
be low since it is memory related operation.
➢ RD¯ will be HIGH since no read operation is done.
➢ WR¯ will be at LOW level only when data fetching is done.
➢ S0=1,S1=0 for Memory write cycle.
Prof. K. Adisesha 36
TIMING AND STATE DIAGRAM
Classification of instructions based on size of 8085
There are three groups of instructions in 8085 microprocessor
based on the length or size of the instruction.
They are–
➢Single byte (or 1 byte) instructions
➢Two byte instructions
➢Three byte instructions
Prof. K. Adisesha 37
INSTRUCTIONS SET OF 8085
Classification of instructions based on size:
Single byte instructions.
This type of instruction has only Opcode and the operand is
specified within the Opcode itself.–
➢Example :
i) MOV B, C
ii) ADD B
Prof. K. Adisesha 38
INSTRUCTIONS SET OF 8085
Classification of instructions based on size:
Two byte instructions.
➢ This type of instruction has Opcode and one operand.
➢ The first byte represents the Opcode and the second byte
represents the 8-bit operand data or 8-bit port address.–
➢Example :
i) MVI A, 50H
ii) OUT 50H
Prof. K. Adisesha 39
INSTRUCTIONS SET OF 8085
Classification of instructions based on size:
Three byte instructions.
➢ This type of instruction has Opcode and two operands.
➢ The first byte represents the Opcode, the second byte presents
the lower order 8-bits of data or address and the third byte
represents the higher order 8-bits of data or address.–
➢Example :
) STA 5000H
ii) LXI B, 5000H
Prof. K. Adisesha 40
INSTRUCTIONS SET OF 8085
Classification of instructions based on function
The Instruction Set of 8085 can be categorized into five different
groups based on the nature of function of the instructions–
➢Data transfer operations
➢Arithmetic operations.
➢Logical operations
➢Branch operations
➢Stack, Input / Output and Machine control operations
Prof. K. Adisesha 41
INSTRUCTIONS SET OF 8085
DATA TRANSFER GROUP
• Using mnemonics without any alteration in the content,
data can be transferred in four different cases –
➢From one register to another register
➢From the memory to the register
➢Move Immediate data to Register
➢From the register to the memory
Prof. K. Adisesha 42
INSTRUCTIONS SET OF 8085
From one register to another register
MOV Rd, Rs.(Move data from Rs to Rd).
Example:
MOV C,B. Move the content of register B to C.
Initially After execution
B=10H. B=10H.
C=20H. C=10H.
• Flags Affected :No flags affected.
• Addressing mode: Register.
Prof. K. Adisesha 43
DATA TRANSFER GROUP
From the memory to the register
MOV Rd, M (Move data from Memory to Rd).
Example:
MOV C,M. Move the content of Memory i.e. “H or L” to C.
Suppose the Data at memory pointed By HL pair at C200H is 10H.
Initially After execution
H=C2,L=00,C=30H H=C2,L=00,C=10H.
Flags Affected :No flags affected.
Addressing mode: Indirect.
Prof. K. Adisesha 44
DATA TRANSFER GROUP
Prof. K. Adisesha 45
Move Immediate data to Register
MVI R, Data.(Move Immediate data to Register).
Example:
MVI B, 30H. (Move the data 30 H to Register B)
Initially After execution
B=40H B=30H
◦ Flags Affected :No flags affected.
◦ Addressing mode: Immediate.
DATA TRANSFER GROUP
LXI Rp,16 bit .(Load 16 bit data to Register pair
Immediate).
Example:
LXI SP, C200H. (Load Stack pointer with C200H).
Initially After execution
SP=C800H SP=C200H.
Flags Affected :No flags affected.
Addressing mode: Immediate.
Prof. K. Adisesha 46
DATA TRANSFER GROUP
From the register to the memory
STA address.(Store Acc data to address).
Example:
STA C200H. (Move the data from Acc to C200H).
Suppose in Acc the data is 10H.
Initially After execution
A=10H, C200=20H C200=10H , A=10H
◦ Flags Affected :No flags affected.
◦ Addressing mode: Direct.
Prof. K. Adisesha 47
DATA TRANSFER GROUP
LHLD address.(Load HL pair with data from address).
Example:
LHLD C200H. (Move the data from C200 to HL pair).
Suppose at C200 the data is 20H,30H .
Initially After execution
H=10H,L=20H H=20H,L=30H.
C2=20H,00=30H C2=20H,00=30H
◦ Flags Affected :No flags affected.
◦ Addressing mode: Direct.
Prof. K. Adisesha 48
DATA TRANSFER GROUP
XCHG (Exchange the data from HL pair to DE pair)
Example : XCHG
Initially After execution
H=20H,L=30H, H=40H,L=70H.
D=40H,E=70H. D=20H,E=30H.
◦ Flags Affected :No flags affected.
◦ Addressing mode: Register.
Prof. K. Adisesha 49
DATA TRANSFER GROUP
IN 8 bit address (Move the data from address to Acc)
Example: IN 80H
Move the data from 80H port address to Accumulator.
Suppose data at 80H is 39H.
Initially After execution
A=20H. A=39H
◦ Flags Affected :No flags affected.
◦ Addressing mode: Direct.
Prof. K. Adisesha 50
DATA TRANSFER GROUP
OUT 8 bit address (Move the data from Acc to address)
Example: OUT 80H
Move the data from Acc to port address 80H.
Suppose data at Acc is 39H.
Initially After execution
A=39H, 80=10H. A=39H, 80=39H.
◦ Flags Affected :No flags affected.
◦ Addressing mode: Direct.
Prof. K. Adisesha 51
DATA TRANSFER GROUP
 Example:
 Write a program to exchange contents of memory location
D000H to D001H
LDA D000H Load Acc with data from D000
MOV B,A Move the data to B
LDA D0001H Load Acc with data from D001
STA 2000H Store Acc data at D000
MOV A,B Move B’s data to A
STA 2001H Store data from D000 to D0001
RST1 Stop.
Prof. K. Adisesha 52
DATA TRANSFER GROUP
Prof. K. Adisesha 53
DATA TRANSFER GROUP
OPCODE OPERAND EXPLANATION EXAMPLE
MOV Rd, Rs Rd = Rs MOV A, B
MOV Rd, M Rd = Mc MOV A, 2050
MOV M, Rs M = Rs MOV 2050, A
MVI Rd, 8-bit data Rd = 8-bit data MVI A, 50
MVI M, 8-bit data M = 8-bit data MVI 2050, 50
LDA 16-bit address A = contents at address LDA 2050
STA 16-bit address contents at address = A STA 2050
LHLD 16-bit address directly loads at H & L registers LHLD 2050
SHLD 16-bit address directly stores from H & L registers SHLD 2050
LXI r.p., 16-bit data loads the specified register pair with data LXI H, 3050
LDAX r.p. indirectly loads at the accumulator A LDAX H
STAX 16-bit address indirectly stores from the accumulator A STAX 2050
XCHG none exchanges H with D, and L with E XCHG
PUSH r.p. pushes r.p. to the stack PUSH H
POP r.p. pops the stack to r.p. POP H
IN 8-bit port address inputs contents of the specified port to A IN 15
OUT 8-bit port address outputs contents of A to the specified port OUT 15
Addressing modes in 8085 can be classified into 5 groups:
➢Immediate addressing mode
➢Register addressing mode
➢Direct addressing mode
➢Indirect addressing mode
➢Implied addressing mode
Prof. K. Adisesha 54
ADDRESSING MODES OF 8085
Immediate addressing:
Immediate data is transferred to address or register.
Example:
MVI A,20H. Transfer immediate data 20H to accumulator.
Number of bytes:
Either 2 or 3 bytes long.
1st byte is opcode.
2nd byte 8 bit data .
3rd byte higher byte data of 16 bytes.
Prof. K. Adisesha 55
ADDRESSING MODES OF 8085
Register addressing:
Data is transferred from one register to other.
Example:
MOV A, C :Transfer data from C register to accumulator.
Number of bytes:
Only 1 byte long.
One byte is opcode.
Prof. K. Adisesha 56
ADDRESSING MODES OF 8085
Direct addressing:
 Data is transferred from direct address to other register or
vice-versa.
Example:
LDA C200H .Transfer contents from C200H to Acc.
Number of bytes:
These are 3 bytes long.
1st byte is opcode.
2nd byte lower address.
3rd byte higher address.
Prof. K. Adisesha 57
ADDRESSING MODES OF 8085
Indirect addressing:
Data is transferred from address pointed by the data in a
register to other register or vice-versa.
Example:
MOV A, M: Move contents from address pointed by M to Acc.
Number of bytes:
These are 3 bytes long.
1st byte is opcode.
2nd byte lower address.
3rd byte higher address.
Prof. K. Adisesha 58
ADDRESSING MODES OF 8085
Implied addressing:
 These doesn’t require any operand. The data is specified in
Opcode itself.
Example: RAL: Rotate left with carry.
No. of Bytes:
These are single byte instruction or Opcode only.
Prof. K. Adisesha 59
ADDRESSING MODES OF 8085
ADD R (ADD register content with Acc and result in A ).
Example:
ADD C. (ADD the content of C with A).
Suppose the Data at C register is 10H.
Initially After execution
C= 10H ,A=10H A=20H,C=10H.
◦ Flags Affected : All flags are modified.
◦ Addressing mode: Register
Prof. K. Adisesha 60
ARITHMETIC GROUP
ADD M(ADD H or L Reg content with Acc and result in A ).
Example:
ADD M. (ADD the content of HL with A).
Suppose the Data at memory pointed by HL register 1020H is 10H.
Initially After execution
H= 10H ,L=20H . H=10H,L=20H.
A=20H,C=10H. A=30H.
o Flags Affected :All flags are modified.
o Addressing mode: Register Indirect.
Prof. K. Adisesha 61
ARITHMETIC GROUP
ADI Data (ADD immediate data with Acc and result in A ).
Example:
ADI 30H. (ADD 30H with A).
Initially After execution
A=20H, A=50H.
◦ Flags Affected :All flags are modified.
◦ Addressing mode: Immediate.
Prof. K. Adisesha 62
ARITHMETIC GROUP
ADC R (ADD register content with Acc and carry and result in A ).
Example:
ADC C. (ADD the content of C with A with carry).
Suppose the Data at C register is 10H and carry is 01H.
Initially After execution
. C= 10H ,A=10H A=21H,C=10H.
◦ Flags Affected :All flags are modified.
◦ Addressing mode: Register
Prof. K. Adisesha 63
ARITHMETIC GROUP
Example: Write a program to perform 16 bit addition of 1234H &
4321H. Store answer at H & L registers.
MVI B,21H B=21H
MVI A,34H A=34H
MVI C,43H C=43H
MVI D,12H D=12H
ADD B A=34+21H
MOV L,A L=55H
MOV A,C A=43H
ADC D A=43+12H
MOV H,A H=55H
RST1 STOP.
Prof. K. Adisesha 64
ARITHMETIC GROUP
SUB R (Subtract register content from Acc and result in A ).
Example:
SUB B. (Subtract the content of B from A ).
Suppose the Data at B register is 10H .
Initially After execution
B= 10H ,A=20H A=10H,B=10H.
◦ Flags Affected :All flags are modified.
◦ Addressing mode: Register
Prof. K. Adisesha 65
ARITHMETIC GROUP
SBB R (Subtract register content from Acc with borrow and result in A ).
Example:
SBB B. (Subtract the content of B from A with borrow).
Suppose the Data at B register is 10H and borrow is 01H .
Initially After execution
B= 0FH ,A=20H A=10H,B=0FH.
◦ Flags Affected :All flags are modified.
◦ Addressing mode: Register
Prof. K. Adisesha 66
ARITHMETIC GROUP
SUI Data(Subtract immediate data from Acc and result in A ).
Example:
SUI 30H. (Subtract 30H from A).
Initially After execution
A=80H, A=50H.
◦ Flags Affected : All flags are modified.
◦ Addressing mode: Immediate
Prof. K. Adisesha 67
ARITHMETIC GROUP
Example: Subtract data of C800 H from C200H.Store the result
at 2C00.
LDA C800H
MOV B,A
LDA C200H
SUB B
STA 2C00H
RST1
Prof. K. Adisesha 68
ARITHMETIC GROUP
DAD Rp (Add specified register pair with HL pair)
Example: DAD D.(Add the content of E with L and that of D with
H register and result in HL pair)
 Suppose the content of HL pair is H=20H ,L=40H and DE pair
is D=30H, E=10H.
Initially After execution
H=20H ,L=40H H=50H ,L=50H
D=30H, E=10H D=30H, E=10H
◦ Flags Affected :Only carry flag is modified.
◦ Addressing mode: Register.
Prof. K. Adisesha 69
ARITHMETIC GROUP
DAA (Decimal adjust accumulator)
Example:
MVI A,12H
ADI 39H
DAA .
This instruction is used to store result in BCD form.If lower
nibble is greater than 9 ,6 is added while if upper nibble is
greater than 9,6 is added to it to get BCD result.
Initially After execution
12+39=4B 12+39=51 in BCD form.
• Flags Affected : All flags are modified.
• Addressing mode: Register
Prof. K. Adisesha 70
ARITHMETIC GROUP
INR R (Increment register content by 1 ).
Example:
INR C. (Increment the content of C by 1).
Suppose the Data at C register is 10H.
Initially After execution
C= 10H C=11H.
 Flags Affected :All flags are modified except carry flag.
 Addressing mode: Register.
Prof. K. Adisesha 71
ARITHMETIC GROUP
DCR R (Decrement register content by 1 ).
Example:
DCR C. (Decrement the content of C by 1).
Suppose the Data at C register is 10H.
Initially After execution
C= 10H C=0FH.
 Flags Affected :All flags are modified except carry flag.
 Addressing mode: Register.
Prof. K. Adisesha 72
ARITHMETIC GROUP
INX Rp (Increment register pair content by 1 ).
Example:
INX SP (Increment the content of Stack pointer pair by 1).
INX B. (Increment the content of BC pair by 1).
Suppose the Data at BC register is 1010H and SP is C200H
Initially After execution
BC= 1010H BC=1011H.
SP=C200H SP=C201H.
 Flags Affected :No flags are modified.
 Addressing mode: Register.
Prof. K. Adisesha 73
ARITHMETIC GROUP
ANA R (Logically AND register content with Acc and result in A ).
Example:
ANA C (AND the content of C with A).
Suppose the Data at C register is 10H.
Initially After execution
C= 10H ,A=10H A=10H,C=10H.
 Flags Affected :S,Z,P are modified Cy=reset, AC=set.
 Addressing mode: Register.
Prof. K. Adisesha 74
LOGICAL GROUP
ANI Data (Logically AND immediate data with Acc and result in
A )
Example:
ANI 10H (AND 10H with A).
Initially After execution
A=10H A=10H
◦ Flags Affected :S,Z,P are modified Cy=reset, AC=set.
◦ Addressing mode: Immediate.
Prof. K. Adisesha 75
LOGICAL GROUP
ORA R (Logically OR register content with Acc and result in A5 )
Example:
ORA C (OR the content of C with A).
Suppose the Data at C register is 17H.
Initially After execution
C= 17H ,A=10H A=17H,C=17H.
◦ Flags Affected :S,Z,P are modified Cy=reset, AC=reset.
◦ Addressing mode: Register.
Prof. K. Adisesha 76
LOGICAL GROUP
ORI Data (Logically OR immediate data with Acc and result in A ).
Example:
ORI 10H (OR 10H with A).
Initially After execution
A=30H A=30H
◦ Flags Affected :S,Z,P are modified Cy=reset,AC=set.
◦ Addressing mode: Immediate.
Prof. K. Adisesha 77
LOGICAL GROUP
XRA R (Logically XOR register content with Acc and result in A ).
Example:
XRA C (XOR the content of C with A).
Suppose the Data at C register is 17H.
Initially After execution
C= 17H ,A=10H A=07H,C=17H.
◦ Flags Affected :S,Z,P are modified Cy=reset, AC=reset.
◦ Addressing mode: Register.
Prof. K. Adisesha 78
LOGICAL GROUP
CMP R (Compare register content with Acc and result in A ).
Example:
CMP C (Compare the content of C with A).
Suppose the Data at C register is 17H.
Initially After execution
C= 10H ,A=17H A=17H,C=17H.
◦ Flags Affected :S=0,Z=0,P=0, Cy=reset, AC=reset.
◦ Addressing mode: Register.
Prof. K. Adisesha 79
LOGICAL GROUP
CPI Data (Compare immediate data with Acc ).
Example:
CPI 10H (Compare the content of C with A).
Initially After execution
A=17H A=17H.
Flags Affected :S=0,Z=0,P=0, Cy=reset,AC=reset.
Addressing mode:Immediate.
Prof. K. Adisesha 80
LOGICAL GROUP
RLC (Rotate accumulator left ).
Example:
MOV A,03H.
RLC (Rotate accumulator left).
Initially After execution
A=03H A=06H.
◦ Flags Affected :Only carry flag is affected.
◦ Addressing mode: Implied.
Prof. K. Adisesha 81
LOGICAL GROUP
RAL (Rotate accumulator left with carry ).
Example:
MOV A,03H.
RAL (Rotate accumulator left with carry).
Initially After execution
A=03H , carry =01H A=07H.
Flags Affected :Only carry flag is affected.
Addressing mode: Implied.
Prof. K. Adisesha 82
LOGICAL GROUP
RRC (Rotate accumulator right ).
Example:
MOV A,03H.
RRC (Rotate accumulator right).
Initially After execution
A=03H , A=81H.
◦ Flags Affected :Only carry flag is affected.
◦ Addressing mode: Implied.
Prof. K. Adisesha 83
LOGICAL GROUP
Write a program to reset last 4 bits of the number 32H
Store result at C200H.
MVI A, 32H A=32H
ANI F0H 00110010 AND 1111000
=00110000=30H
STA C200H. C200=30H
RST1 Stop
Prof. K. Adisesha 84
LOGICAL GROUP
JMP address(Unconditional jump to address)
Example:
JMP C200H.
 After this instruction the Program Counter is loaded with this
location and starts executing and the contents of PC are
loaded on Stack.
 Flags Affected :No Flags are affected.
 Addressing mode: Immediate.
Prof. K. Adisesha 85
BRANCH GROUP
CALL address(Unconditional CALL from address)
Example:
CALL C200H.
 After this instruction the Program Counter is loaded
with this location and starts executing and the contents
of PC are loaded on Stack.
◦ Flags Affected :No Flags are affected.
◦ Addressing mode: Immediate
Prof. K. Adisesha 86
BRANCH GROUP
Conditional Jump Instructions.
➢ JC (Jump if Carry flag is set)
➢ JNC (Jump if Carry flag is reset)
➢ JZ (Jump if zero flag set)
➢ JNZ (Jump if zero flag is reset)
➢ JPE (Jump if parity flag is set)
➢ JPO (Jump if parity odd or P flag is reset )
➢ JP (Jump if sign flag reset )
➢ JM (Jump if sign flag is set or minus)
Prof. K. Adisesha 87
BRANCH GROUP
Conditional Call Instructions.
➢ CC (Call if Carry flag is set)
➢ CNC (Call if Carry flag is reset)
➢ CZ (Call if zero flag set)
➢ CNZ (Call if zero flag is reset)
➢ CPE (Call if parity flag is set)
➢ CPO (Call if parity odd or P flag is reset )
➢ CP (Call if sign flag reset )
➢ CM (Call if sign flag is set or minus)
Prof. K. Adisesha 88
BRANCH GROUP
RET (Return from subroutine)
Example:
MOV A,C
RET
 After this instruction the Program Counter POPS PUSHED
contents from stack and starts executing from that address .
Flags Affected :No Flags are affected.
Addressing mode:Register indirect .
Prof. K. Adisesha 89
BRANCH GROUP
RST (Restart instruction)
Example:
MOV A,C
RST 1.
 After this instruction the Program Counter goes to address
0008H and starts executing from that address .
◦ Flags Affected :No Flags are affected.
◦ Addressing mode: Register indirect.
Prof. K. Adisesha 90
BRANCH GROUP
Programming Techniques in 8085:
To implement program logic we need to take help of some
common Programming Techniques in Microprocessor 8085
such as:
➢ Looping: In this Programming Techniques the Program is instructed to
execute certain set of instructions repeatedly to execute a particular task
number of times.
➢ Counting: This technique allows programmer to count how many times
the instruction/set of instructions are executed
➢ Indexing and code conversion: This Techniques in allows programmer to
point or refer the data stored in sequential memory locations one by one.
Prof. K. Adisesha 91
Programming Techniques
Programming Techniques in 8085:
The Program loop is the basic structure which forces the
processor to repeat a sequence of instructions.
➢ Loops are of 2 types:
❖Continuous(repeats a task continuously)
❖Conditional(repeats a task until certain
data conditions are met)
➢ Loops have four sections.:
❖Initialization section.
❖Processing section.
❖Loop control section
❖Result section.
Prof. K. Adisesha 92
Programming Techniques
Counters in 8085:
This programming technique uses instructions, as loop is established to
update count and each count is checked to determine whether it has
reached final number and if not reached, then the loop is repeated.
➢ Time Delay:
❖It is a similar programming technique used to set up a counter
❖Register is loaded with a number depending on the time delay required and then
register is decremented until it reached zero.
➢ It is achieved by two methods:
❖Using a register
❖Using a register pair.
Prof. K. Adisesha 93
Programming Techniques
Timer Delay Using Counters:
Counting can create time delays. Since the execution times of the
instructions used in a counting routine are known, the initial value of the
counter, required to get specific time delay can be determined.
Prof. K. Adisesha 94
Programming Techniques
Timer Delay Using Nested Loops:
In this, there are more than one loops. The innermost loop is same as
explained above. The outer loop sets the multiplying count to the delays
provided by the innermost loop.
Prof. K. Adisesha 95
Programming Techniques
Timer Delay Using NOP Instruction:
NOP instruction does nothing but takes 4T states of processor
time to execute.
➢ So by executing NOP instruction in between two instructions we can get
delay of 4 T-state.
➢ If the 8085 MPU is working on 6MHz clock frequency, then the internal
clock frequency is 3MHz.
➢ To determine that each clock period is 1/3 of a microsecond.
➢ So the NOP will be executed in 1/3 * 4 = 1.333µs.
Prof. K. Adisesha 96
Programming Techniques
Timers Delay in 8085:
In the real time applications, such as traffic light control, digital clock,
process control, serial communication, it is important to keep a track
with time.
➢ The delay time is given by the total time taken to execute the delay routine.
➢ It can be computed by multiplying the total number of T-states required to
execute subroutine and the time for one T-state of the processor.
➢ The time for one T-state of the processor is given by the inverse of the
system clock frequency of the processor.
➢ Example:
❖If the 8085 microprocessor has system clock frequency = 2.5 MHz.
❖Then, time for one T-state= 1 / 2.5 x 106
❖ = 0.4µsec
Prof. K. Adisesha 97
Programming Techniques
Example Time Delay in 8085:
Write a delay routine to produce a time delay of 0.5 mS in 8085 processor-based system
whose clock frequency is 3 MHz.
➢ Calculation to find the count value, N:
Prof. K. Adisesha 98
Programming Techniques
Instruction T-State required Number of times the
instruction is executed
Total T-States
CALL addr16
Loop: MVI D, N
DCR D
JNZ LOOP
RET
18
7
4
10 (or) 7
10
1
1
N times
(N-1) times,
1
1
18 x 1 = 18
7 x 1 = 7
4 x N = 4N
10 x (N-1) = 10N - 10
7 x 1 = 7
10 x 1 = 10
TOTAL T-STATES FOR DELAY SUBROUTINE 14N + 32
Calculation of Delay using 8 bit counter:
 Consider following example:
MVI C, count(8 bit) H 7 T states
UP DCR C 4 T states
JNZ UP 10/7 T
RET 10T
 Here loop UP is executed (N-1) times.
 Thus delay is
Td=M+[(count)x N) -3.
 Where M= no.of T states outside loop.
N=no.of T states inside loop.
Prof. K. Adisesha 99
Programming Techniques
➢ Here value of M= 17, N= 14.
➢ The maximum delay will occur if count is 255 or FF H.
➢ Thus Td max =17+[255x14]-3= 3584 T states.
➢ For 0.5 µsec delay for a T state, we get
➢ Td max=0.5 µsec x 3584= 1792 µsec or 1.792 m sec.
Prof. K. Adisesha 100
Programming Techniques
Code Conversion:
This Programming Techniques in Microprocessor 8085 is to
translate a number represented using one coding system to
another.
➢ The code conversion involves some basic conversions such as:
❖BCD to Binary conversion
❖Binary to BCD conversion
❖BCD to seven segment code conversion
❖Binary to ASCII conversion and
❖ASCII to binary conversion
Prof. K. Adisesha 101
Programming Techniques
The stack is a reserved area of the memory in RAM
where we can store temporary information.
Prof. K. Adisesha 102
STACK AND MACHINE CONTROL
➢The stack is a shared resource as it
can be shared by the microprocessor
and the programmer.
➢The programmer can use the stack to
store data.
➢The microprocessor uses the stack to
execute subroutines.
The stack is an area of memory identified by the programmer for
temporary storage of information.
 The stack is a LIFO structure.
– Last In First Out.
 The stack normally grows backwards into memory.
 In the 8085, the stack is defined by setting the
SP (Stack Pointer) register.
• LXI SP, FFFFH
Prof. K. Adisesha 103
STACK AND MACHINE CONTROL
Saving Information on the Stack.
 Information is saved on the stack by PUSHing it on.
 It is retrieved from the stack by POPing it off.
 The 8085 provides two instructions:
◦ PUSH – This is the instruction we use to write information on
the stack.
◦ POP – This is the instruction we use to read information from
the stack.
Prof. K. Adisesha 104
STACK AND MACHINE CONTROL
PUSH Rp. (Push register pair contents on stack).
Example:
LXI SP FFFFH.
PUSH B. (Move the content of BC pair on Stack).
 Suppose at HL pair the data is H= 20H,L= 30H & SP is initialized at
FFFFH
Initially After execution
B=12H,C=F3H B=12H,C=F3H.
SP=FFFF H FFD=F3H,FFFE=12H
◦ Flags Affected :No flags affected.
◦ Addressing mode: Register indirect.
Prof. K. Adisesha 105
STACK AND MACHINE CONTROL
POP Rp. (Pop register pair contents from stack).
Example:
POP D(POP the content of DE pair from Stack).
 POP D (1 Byte Instruction)
 – Copy the contents of the memory location pointed to by the SP to
register E
 – Increment SP
 – Copy the contents of the memory location pointed to by the SP to
register D
 – Increment SP
 Flags Affected :No flags affected.
◦ Addressing mode: Register indirect
Prof. K. Adisesha 106
STACK AND MACHINE CONTROL
Saving Information on the Stack.
 There are two methods to add data to the stack:
❖Direct method
❖Indirect method
 Direct method: The stack pointers address is loaded
into the stack pointer register directly.
 Indirect method: The stack pointers address is loaded
into the stack pointer register via another register pair.
Prof. K. Adisesha 107
STACK AND MACHINE CONTROL
Saving Information on the Stack.
 Direct method: The stack pointers address is loaded
into the stack pointer register directly.
LXI SP, 8000H
LXI H, 1234H
PUSH H
POP D
HLT
Prof. K. Adisesha 108
STACK AND MACHINE CONTROL
Saving Information on the Stack.
 Direct method: The stack pointers address is loaded
into the stack pointer register directly.
➢ LXI SP, 8000H – The address of the stack pointer is set to 8000H by loading the
number into the stack pointer register.
➢ LXI H, 1234H – Next, we add a number to the HL pair. The most significant two
bits will enter the H register. The least significant two bits will enter the L register.
➢ PUSH H – The PUSH command will push the contents of the H register first to
the stack. Then the contents of the L register will be sent to the stack.
➢ POP D – The POP command will remove the contents of the stack and store
them to the DE register pair.
Prof. K. Adisesha 109
STACK AND MACHINE CONTROL
Saving Information on the Stack.
 Indirect method: The stack pointers address is loaded
into the stack pointer register via another register pair.
LXI H, 8000H
SPHL
LXI H, 1234H
PUSH H
POP D
HLT
Prof. K. Adisesha 110
STACK AND MACHINE CONTROL
Saving Information on the Stack.
 Indirect method: The stack pointers address is loaded
into the stack pointer register via another register pair.
➢LXI H, 8000H – The number that we wish to enter into the stack pointer,
8000H, is loaded into the HL pair register.
➢SPHL – This is a special command that we can use to transfer data from HL
pair to Stack pointer (SP). Now, the contents of the HL pair are in the SP.
➢LXI H, 1234H – Next, we add a number to the HL pair.
➢PUSH H – The PUSH command will push the contents of the H register first to
the stack. Then the contents of the L register will be sent to the stack.
➢POP D – The POP command will remove the contents of the stack and store
them to the DE register pair.
Prof. K. Adisesha 111
STACK AND MACHINE CONTROL
XTHL (Exchange HL register pair contents with top of stack).
Example: XTHL(Exchange top with HL pair).
 Suppose at HL pair the data is H= 20H,L= 30H & SP =FFFFH
& at locations FFFF=10H and at FFFE= 80H.
Initially After execution
H=20H,L=30H H=10H,L=80H.
SP=FFFF =10H,FFFE=80H FFFD=20H,FFFE=30H
◦ Flags Affected :No flags affected.
◦ Addressing mode: Register indirect.
Prof. K. Adisesha 112
STACK AND MACHINE CONTROL
A Subroutine: It is a small program written separately from the
main program to perform a particular task that you may
repeatedly require in the main program.
 The concept of a subroutine is that it is used to avoid the
repetition of smaller programs.
 Subroutines are written separately and are stored in a
memory location that is different from the main program.
 You can call a subroutine multiple times from the main
program using a simple CALL instruction.
 The subroutine can be exited from using a return (RET)
instruction.
Prof. K. Adisesha 113
SUBROUTINE
A Subroutine: in the microprocessor is a sequence of program
instructions code that performs a particular task.
 A subroutine is a unit which is used in multiple times in
different location.
 The four types of subroutine have in the microprocessor:
❖Unconditional Call instruction
❖Conditional call instruction
❖Unconditional return instruction
❖Conditional return instruction
Prof. K. Adisesha 114
SUBROUTINE
Unconditional CALL / RET statements: We can use
Unconditional CALL / RET statements, to call a subroutine
multiple times from the main program using a simple CALL
instruction.
Prof. K. Adisesha 115
SUBROUTINE
Conditional CALL statements: You can use conditional CALL
statements, too, according to your needs. These statements
enter a subroutine only when a certain condition is met.
 CC Call at address if cy (carry flag) = 1
 CNC Call at address if cy (carry flag) = 0
 CZ Call at address if ZF (zero flag) = 1
 CNZ Call at address if ZF (zero flag) = 0
 CPE Call at address if PF (parity flag) = 1
 CPO Call at address if PF (parity flag) = 0
 CN Call at address if SF (signed flag) = 1
 CP Call at address if SF (signed flag) = 0
Prof. K. Adisesha 116
SUBROUTINE
Conditional return (RET) statements: You can use conditional
RET statements, too, according to your needs. These
statements ensure that a subroutine is exited only when a
certain condition is met.
 RC Return from subroutine if cy (carry flag) = 1
 RNC Return from subroutine if cy (carry flag) = 0
 RZ Return from subroutine if ZF (zero flag) = 1
 RNZ Return from subroutine if ZF (zero flag) = 0
 RPE Return from subroutine if PF (parity flag) = 1
 RPO Return from subroutine if PF (parity flag) = 0
 RN Return from subroutine if SF (signed flag) = 1
 RP Return from subroutine if SF (signed flag) = 0
Prof. K. Adisesha 117
SUBROUTINE
Advantages of using subroutines: The various advantages of
using subroutines are:
➢ Subroutines avoid the repetition of instructions.
➢ They give an aspect of modular programming to the entire program.
➢ Improves efficiency by reducing the size of the memory needed to store
the program.
Prof. K. Adisesha 118
SUBROUTINE
At the time of executing one 8085 program, interruption can be
done in the mid-way by the virtue of the program by an Input
Output device.
 The communication is not done directly with the Input Output
device rather done by the virtue of an Input Output port.
 The data transfer can be either in two forms:
❖Parallel data transfer
❖Serial data transfer
Prof. K. Adisesha 119
Data transfer schemes in 8085
For transferring data in parallel we have three different ways by
which microprocessor communicates with an Input or Output:.
 Basic or simple data transfer scheme: This method is beneficial to
us when we have accurate know-ledge of the Input Output device timing
characteristics.
 Status check data transfer: Status check data transfer process is a
much more complex process than simple data transfer.
 Interrupt driven data transfer: We use this method when there lacks
accurate knowledge of the timing characteristics of the Input Output
device which takes maximum time for the device to be ready for use.
Prof. K. Adisesha 120
Data transfer schemes in 8085
 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.
 Classification of Interrupts
Interrupts can be classified into two main types:
➢Maskable Interrupts (Can be delayed or Rejected)
➢Non-Maskable Interrupts (Can not be delayed or Rejected)
Prof. K. Adisesha 121
INTERRUPTS IN 8085
 Interrupt is a process where an external device can get the
attention of the microprocessor.
Interrupts can be classified into six sub groups:
❖Vector interrupt
❖Non-Vector interrupt
❖Maskable Interrupts
❖Non-Maskable Interrupts
❖Software interrupt
❖Hardware interrupt
Prof. K. Adisesha 122
INTERRUPTS IN 8085
Interrupts can also be classified into:
➢Vector interrupt − In this type of interrupt, the interrupt
address is known to the processor. For example: RST7.5,
RST6.5, RST5.5, TRAP.
➢Non-Vector interrupt − In this type of interrupt, the interrupt
address is not known to the processor so, the interrupt
address needs to be sent externally by the device to perform
interrupts. For example: INTR.
➢Maskable interrupt − In this type of interrupt, we can disable
the interrupt by writing some instructions into the program.
For example: RST7.5, RST6.5, RST5.5.
Prof. K. Adisesha 123
INTERRUPTS IN 8085
Interrupts can also be classified into:
➢Non-Maskable interrupt − In this type of interrupt, we cannot
disable the interrupt by writing some instructions into the
program. For example: TRAP.
➢Software interrupt − In this type of interrupt, the programmer
has to add the instructions into the program to execute the
interrupt. There are 8 software interrupts in 8085, i.e. RST0,
RST1, RST2, RST3, RST4, RST5, RST6, and RST7.
➢Hardware interrupt − There are 5 interrupt pins in 8085 used
as hardware interrupts, i.e. TRAP, RST7.5, RST6.5, RST5.5,
INTA.
Prof. K. Adisesha 124
INTERRUPTS IN 8085
The 8085 has 5 interrupt inputs.
The INTR input.
◦ The INTR input is the only non-vectored interrupt.
◦ INTR is mask-able using the EI/DI instruction pair.
RST 5.5, RST 6.5, RST 7.5 are all automatically vectored.
◦ RST 5.5, RST 6.5, and RST 7.5 are all mask-able.
TRAP is the only non-mask-able interrupt in the 8085
◦ TRAP is also automatically vectored.
Prof. K. Adisesha 125
INTERRUPTS IN 8085
Non vectored interrupts:
 The 8085 recognizes 8 RESTART instructions: RST0 - RST7 .
Each of these would send the execution to a predetermined hard-
wired memory location:
Restart
Instruction
Equivalent to
RST0 CALL 0000H
RST1 CALL 0008H
RST2 CALL 0010H
RST3 CALL 0018H
RST4 CALL 0020H
RST5 CALL 0028H
RST6 CALL 0030H
RST7 CALL 0038H
Prof. K. Adisesha 126
INTERRUPTS IN 8085
Interrupt name Mask-able Vectored
TRAP No Yes
RST 7.5 Yes Yes
RST 6.5 Yes Yes
RST 5.5 Yes Yes
INTR YES NO
Prof. K. Adisesha 127
INTERRUPT PRIORITY
128
SOD
SDE
XXX
R7.5
MSE
M7.5
M6.5
M5.5
0
1
2
3
4
5
6
7
RST5.5 Mask
RST6.5 Mask
RST7.5 Mask
}0 - Available
1 - Masked
Mask Set Enable
0 - Ignore bits 0-2
1 - Set the masks according
to bits 0-2
Force RST7.5 Flip Flop to reset
Not Used
Enable Serial Data
0 - Ignore bit 7
1 - Send bit 7 to SOD pin
Serial Out Data
•SIM Instruction helps activate a particular interrupt.
•It can also mask a maskable interrupt.
Prof. K. Adisesha 128
SIM INSTRUCTION
 Example: Set the interrupt masks so that RST5.5 is
enabled, RST6.5 is masked, and RST7.5 is enabled.
 First, determine the contents of the accumulator.
- Enable 5.5 bit 0 = 0
- Disable 6.5 bit 1 = 1
- Enable 7.5 bit 2 = 0
- Allow setting the masks bit 3 = 1
- Don’t reset the flip flop bit 4 = 0
- Bit 5 is not used bit 5 = 0
- Don’t use serial data bit 6 = 0
- Serial data is ignored bit 7 = 0
SDO
SDE
XXX
R7.5
MSE
M7.5
M6.5
M5.5
0 1 0
0
0
0
0 1
EI ; Enable interrupts including INTR
MVI A, 0A ; Prepare the mask to enable RST 7.5, and 5.5, disable 6.5
SIM ; Apply the settings RST masks
Prof. K. Adisesha 129
SIM INSTRUCTION
Serial Data In
RST5.5 Interrupt Pending
RST6.5 Interrupt Pending
RST7.5 Interrupt Pending
0 - Available
1 - Masked
Interrupt Enable
Value of the Interrupt Enable
Flip Flop
SDI
P7.5
P6.5
P5.5
IE
M7.5
M6.5
M5.5
0
1
2
3
4
5
6
7
RST5.5 Mask
RST6.5 Mask
RST7.5 Mask
}
•Since the 8085 has five interrupt lines, interrupts may occur during an
ISR and remain pending.
•Using the RIM instruction, it is possible to can read the status of the
interrupt lines and find if there are any pending interrupts.
Prof. K. Adisesha 130
RIM INSTRUCTION
8259 microprocessor is defined as Programmable Interrupt
Controller (PIC) microprocessor.
➢ There are 5 hardware interrupts interrupts in 8085.
➢ 8259 combines the multi interrupt input sources into a single interrupt
output. Interfacing of single PIC provides 8 interrupts inputs from IR0-IR7.
➢ Features of 8259 PIC microprocessor –
❖ Intel 8259 is designed for Intel 8085 and Intel 8086 microprocessor.
❖ It can be programmed either in level triggered or in edge triggered
interrupt level.
❖ We can masked individual bits of interrupt request register.
❖ We can increase interrupt handling capability unto 64 interrupt level
by cascading further 8259 PIC.
❖ Clock cycle is not required.
Prof. K. Adisesha 131
Programmable Interrupt Controller
8259 microprocessor is defined as Programmable Interrupt
Controller (PIC) microprocessor.
Prof. K. Adisesha 132
Programmable Interrupt Controller
➢ There are 5 hardware interrupts
pins and 2 hardware interrupts
in 8085.
➢ Interfacing of 8085 and 8259
increases the interrupt handling
capability of 8085
microprocessor from 5 to 8
interrupt levels.
Interfacing of 8085 and 8259 increases the interrupt handling
capability of 8085 microprocessor from 5 to 8 interrupt levels.
Prof. K. Adisesha 133
Programmable Interrupt Controller
Working of 8259 with 8085 processor:
➢ First the 8259 should be programmed by
sending Initialization Command Word (ICW)
➢ and Operational Command Word (OCW).
These command words will inform 8259
about the
➢ following,
➢ Type of interrupt signal (Level triggered /
Edge triggered).
❖ Type of processor (8085/8086).
❖ Call address and its interval (4 or 8)
❖ Masking of interrupts.
➢ Generally µP 8085 can address 64 kB of memory .
➢ Generally EPROMS are used as program memory and RAM
as data memory.
➢ We can interface Multiple RAMs and EPROMS to single µP .
➢ Memory interfacing includes 3 steps :
1.Select the chip.
2.Identify register.
3.Enable appropriate buffer.
Prof. K. Adisesha 134
8085 Peripherals Interfacing
Data Transfer Techniques:
 parallel data transfer scheme, multiple data bits can be
transmitted at the same time.
 Thus, for the Intel 8085, 8 bits of data are sent all together
using eight parallel lines.
 Different types of parallel data transferare:
➢Programmed I/O Data Transfer
➢Interrupt Driven I/O Data Transfer
➢Device or Direct Memory Access (DMA) Data Transfer
Prof. K. Adisesha 135
8085 Peripherals Interfacing
Programmed I/O Data Transfer:
 This method can work under the synchronous and
asynchronous mode, depending on the speed and architecture
of the I/O devices.
 We also prefer this method when there is a small amount of
information to be exchanged between the microprocessor and
other devices. Example: Computer, printer, etc.
 Using the IN and OUT instructions, data transfer is carried out
between the microprocessor and I/O devices.
Prof. K. Adisesha 136
8085 Peripherals Interfacing
Programmed I/O Data Transfer:
 Using the IN and OUT instructions, data transfer is carried out
between the microprocessor and I/O devices.
Prof. K. Adisesha 137
8085 Peripherals Interfacing
Interrupt Driven I/O Data Transfer:
 Interrupt Driven I/O Data Transfer is a much better option.
 Here, no extra time of the microprocessor is wasted in waiting
for a response/signal from the external device.
 Under this method, the I/O device informs the microprocessor
about its readiness, only when it is ready.
Prof. K. Adisesha 138
8085 Peripherals Interfacing
Direct Memory Access (DMA) Data Transfer:
 This is an ideal method used for bulk data transfer of a
considerable amount between the microprocessor and the I/O
device. It is also considered the fastest data transfer scheme..
Prof. K. Adisesha 139
8085 Peripherals Interfacing
 The diagram of 2k interfacing is shown below:
A15-A8
Latch
AD7-AD0
D7- D0
A7- A0
8085
ALE
IO/M
RD
WR
2K Byte
Memory
Chip
WR
RD
CS
A10- A0
A15- A11
3:8DECODER
Prof. K. Adisesha 140
8085 Memory Interfacing
➢ Address lines A0-A10 are used to interface memory while
A11,A12,A13,A14,A15 are given to 3:8 Decoder to provide an
output signal used to select the memory chip CS¯or Chip select
input.
➢ MEMR¯ and MEMW¯are given to RD¯and WR¯pins of Memory
chip.
➢ Data lines D0-D7 are given to D0-D7 pins of the memory chip.
➢ In this way memory interfacing can be achieved.
Prof. K. Adisesha 141
8085 Memory Interfacing
Programmable peripheral interface 8255
➢ PPI 8255 is a general purpose programmable I/O device to
interface the CPU such as ADC, DAC, keyboard etc.
➢ We can program it according to the given condition. It can be
used with almost any microprocessor.
➢ It consists of three 8-bit bidirectional I/O ports:
❖PORT A
❖PORT B
❖PORT C
➢ We can assign different ports as input or output functions. .
Prof. K. Adisesha 142
8085 Peripherals Interfacing
PA0-PA7 I/O Port A Pins
PB0-PB7 I/O Port B Pins
PC0-PC7 I/O Port C Pins
D0-D7 I/O Data Pins
RESET I Reset pin
RD¯ I Read input
WR ¯ I Write input
A0-A1 I Address pins
CS ¯ I Chip select
Vcc , Gnd I +5volt supply
Prof. K. Adisesha 143
8255 PIN DIAGRAM
Prof. K. Adisesha 144
8255 BLOCK DIAGRAM
➢ Data Bus Buffer: It is an 8 bit data buffer used to interface
8255 with 8085. It is connected to D0-D7 bits of 8255.
➢ Read/write control logic: It consists of inputs
RD¯, WR¯, A0, A1, CS¯ .
❖ RD¯,WR¯ :are used for reading and writing on to 8255 and are
connected to MEMR¯,MEMW¯ of 8085 respectively.
❖ A0,A1 :are Port select signals used to select the particular port .
❖ CS ¯ :is used to select the 8255 device .
❖ It is controlled by the output of the 3:8 decoder used to decode the
address lines of 8085.
Prof. K. Adisesha 145
8255 BLOCK DIAGRAM
Depending upon the value if CS’, A1 and A0 we can select
different ports in 8255.
Prof. K. Adisesha 146
8255 BLOCK DIAGRAM
➢ This is done by writing a
suitable word in control
register (control word
D0-D7).
Group A and Group B Control:
❖ Group A control consists of Port A and Port C upper.
❖ Group B control consists of Port A and Port C lower.
Each group is controlled through software.
➢ They receive commands from the RD¯, WR¯ pins to allow
access to bit pattern of 8085.
➢ The bit pattern consists of :
1. Information about which group is operated.
2. Information about mode of Operation.
Prof. K. Adisesha 147
8255 BLOCK DIAGRAM
 PORT A, B: These are bi-directional 8 bit ports each and are
used to interface 8255 with CPU or peripherals.
◦ Port A is controlled by Group A while Port B is controlled by Group B
Control.
 PORT C: This is a bi-directional 8 bit port controlled partially
by Group A control and partially by Group B control .
◦ It is divided into two parts Port C upper and Port C lower each of a
nibble.
 It is used mainly for control signals and interfacing with
peripherals.
Prof. K. Adisesha 148
8255 BLOCK DIAGRAM
 Mode 0 : Simple I/O
• Any of A, B, CL and CH can be programmed as input or output
 Mode 1: I/O with Handshake
• A and B can be used for I/O
• C provides the handshake signals
 Mode 2: Bi-directional with handshake
• A is bi-directional with C providing handshake signals
• B is simple I/O (mode-0) or handshake I/O (mode-1)
 BSR (Bit Set Reset) Mode
• Only C is available for bit mode access.
• Allows single bit manipulation for control applications
Prof. K. Adisesha 149
8255 MODES
 Thus we get addresses ,considering don’t cares to be zero as
Port A =8000H
Port B =8001H
Port C =8002H
CWR =8003H
 We give A11,A12,A13 pins to A,B,C inputs of Decoder to
enable 8255 or Chip Select.
 A15 is logic 1 so it is given to active HIGH G1 pin& A14 ,IO/M
¯ are given to active low G2B ¯,G2A ¯ pins.
 Output from Latch is given as A0,A1 pins to 8255 while D0-D7
are given as data inputs.
Prof. K. Adisesha 150
INTERFACING 8085 & 8255
8255
8085 3:8 decoder
74373
(AD0-AD7)
D7-D0
A0-A7
/CS
A0
A1
O0
O1
O7
A13
A12
A11
ALE
RD ¯
WR ¯
RD¯
WR¯
G2A G2B G1
A15
A14
IO/M
A
B
C
PA
PB
PC
Prof. K. Adisesha 151
INTERFACING 8085 & 8255
Prof. K. Adisesha 152
DMA
 It is a 4 Channel DMA containing 4 individual I/P ,O/P
Channels.
CH0,CH1,CH2,CH3
 It is compatible with Intel processors.
 The maximum frequency is 3 MHz.
 It executes 3 cycles:
1.DMA read
2.DMA write.
3.DMA verify.
 The external device can terminate DMA Operation
Prof. K. Adisesha 153
8257 DMA
➢ Rotating priority mode: Each channel has equal priority.
Priority is shifted from one channel to other.
➢ Fixed priority mode: Each channel has a fixed priority and if
higher priority channels are busy then smaller priority will get
to serve.
➢ Extended write mode: This mode is used to interface slower
devices to the system.
➢ TC stop mode: If this bit is set the channel whose terminal
count is reached is disabled.
➢ Auto reload mode: If this bit is set data is transferred by
channel 2 only. All other channels are not used.
Prof. K. Adisesha 154
OPERRATING MODES OF 8257
Serial Communications systems are of three types:
Simplex: This is a one way communication.
 Only one party can speak.
 The other party only hears to the first one but cant
communicate.
System A System B
unidirectional
Transmitter Receiver
Prof. K. Adisesha 155
SERIAL COMMUNICATION
System A System B
OR
Transmi
tter/Rec
eiver
Receiver
/Transm
itter
Half Duplex: It is a two way communication between two
ports provided that only party can communicate at a time.
• When one party stops transmitting the other starts transmitting.
• The first party now acts as a receiver.
Prof. K. Adisesha 156
SERIAL COMMUNICATION
OR/AND.
Full Duplex: It is a two way communication between two ports
and both parties can communicate at same time.
 Thus here efficient communication can be established.
Transmitter/
Receiver
Receiver/
Transmitter.
Prof. K. Adisesha 157
SERIAL COMMUNICATION
Asynchronous Synchronous
1. It transfers one character at a
time.
1. It transfers group of
characters at a time.
2. Used for transfer data rates
<20KBPS
2. Used for transfer data rates
>20KBPS
3. Start and stop bit for each
character which forms a frame.
3. No start and stop bit for
each character.
4. Two Clocks are used for Tx
and Rx
4. Single clock is used for both
Tx and Rx.
Prof. K. Adisesha 158
TRANSMISSION FORMATS
Prof. K. Adisesha 159
8253 BLOCK DIAGRAM
 Three independent 16 bit counters.
 24 pin Dual in line Package.
 Counting facility in Both BCD and Binary modes.
 Dc to 2 MHz operating Frequency.
 Can be used as a clock generator.
Prof. K. Adisesha 160
8253 Features
Prof. K. Adisesha 161
Feedback

More Related Content

Similar to Introduction to 8085 by Adi PPT.pdf

Introduction to 8085 microprocessor
Introduction to 8085 microprocessorIntroduction to 8085 microprocessor
Introduction to 8085 microprocessorkunj desai
 
MICROPROCESSOR_Notes.pptx
MICROPROCESSOR_Notes.pptxMICROPROCESSOR_Notes.pptx
MICROPROCESSOR_Notes.pptxWorkingad
 
20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notesManikanteswar Madala
 
Download
DownloadDownload
Downloadjaihooo
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxMeghdeepSingh
 
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080Vivek Venugopal
 
20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notesRavali Sunki
 
Microprocessor and Microcontroller lec5
Microprocessor and Microcontroller lec5Microprocessor and Microcontroller lec5
Microprocessor and Microcontroller lec5Ameen San
 
Microprocessors 8085 architecture
Microprocessors 8085 architectureMicroprocessors 8085 architecture
Microprocessors 8085 architectureVARUN BABUNELSON
 
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONSRamaPrabha24
 
Robotics & Embedded IoT System Design [Day-3]
Robotics & Embedded IoT System Design [Day-3]Robotics & Embedded IoT System Design [Day-3]
Robotics & Embedded IoT System Design [Day-3]Deepam Dubey
 
Architecture and pin diagram of 8085
Architecture and pin diagram of 8085Architecture and pin diagram of 8085
Architecture and pin diagram of 8085Suchismita Paul
 
itft-8085 microprocessor
itft-8085 microprocessoritft-8085 microprocessor
itft-8085 microprocessorShifali Sharma
 
architecture memory interfacing
architecture memory interfacingarchitecture memory interfacing
architecture memory interfacingShamsul Huda
 
Seminar topic.on embeded system
Seminar topic.on embeded systemSeminar topic.on embeded system
Seminar topic.on embeded systemSachinMaithani1
 

Similar to Introduction to 8085 by Adi PPT.pdf (20)

Introduction to 8085 microprocessor
Introduction to 8085 microprocessorIntroduction to 8085 microprocessor
Introduction to 8085 microprocessor
 
MICROPROCESSOR_Notes.pptx
MICROPROCESSOR_Notes.pptxMICROPROCESSOR_Notes.pptx
MICROPROCESSOR_Notes.pptx
 
20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes
 
Download
DownloadDownload
Download
 
MP_MC.pdf
MP_MC.pdfMP_MC.pdf
MP_MC.pdf
 
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptxINDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
INDUSTRIAL TRAINING REPORT EMBEDDED SYSTEM.pptx
 
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
AN INTEGRATED FOUR-PORT DC-DC CONVERTER-CEI0080
 
20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes20838382 microprocessor-8085-notes
20838382 microprocessor-8085-notes
 
Microprocessor and Microcontroller lec5
Microprocessor and Microcontroller lec5Microprocessor and Microcontroller lec5
Microprocessor and Microcontroller lec5
 
Microprocessors 8085 architecture
Microprocessors 8085 architectureMicroprocessors 8085 architecture
Microprocessors 8085 architecture
 
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
8085 MICROPROCESSOR ARCHITECTURE AND ITS OPERATIONS
 
Qb microprocessors
Qb microprocessorsQb microprocessors
Qb microprocessors
 
Robotics & Embedded IoT System Design [Day-3]
Robotics & Embedded IoT System Design [Day-3]Robotics & Embedded IoT System Design [Day-3]
Robotics & Embedded IoT System Design [Day-3]
 
Architecture and pin diagram of 8085
Architecture and pin diagram of 8085Architecture and pin diagram of 8085
Architecture and pin diagram of 8085
 
itft-8085 microprocessor
itft-8085 microprocessoritft-8085 microprocessor
itft-8085 microprocessor
 
architecture memory interfacing
architecture memory interfacingarchitecture memory interfacing
architecture memory interfacing
 
Microprocessor history1
Microprocessor history1Microprocessor history1
Microprocessor history1
 
Microprocessor history1
Microprocessor history1Microprocessor history1
Microprocessor history1
 
Seminar topic.on embeded system
Seminar topic.on embeded systemSeminar topic.on embeded system
Seminar topic.on embeded system
 
Introduction to 8085svv
Introduction to 8085svvIntroduction to 8085svv
Introduction to 8085svv
 

More from Prof. Dr. K. Adisesha

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfProf. Dr. K. Adisesha
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfProf. Dr. K. Adisesha
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaProf. Dr. K. Adisesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaProf. Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfProf. Dr. K. Adisesha
 

More from Prof. Dr. K. Adisesha (20)

Software Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdfSoftware Engineering notes by K. Adisesha.pdf
Software Engineering notes by K. Adisesha.pdf
 
Software Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdfSoftware Engineering-Unit 1 by Adisesha.pdf
Software Engineering-Unit 1 by Adisesha.pdf
 
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdfSoftware Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
Software Engineering-Unit 2 "Requirement Engineering" by Adi.pdf
 
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdfSoftware Engineering-Unit 3 "System Modelling" by Adi.pdf
Software Engineering-Unit 3 "System Modelling" by Adi.pdf
 
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdfSoftware Engineering-Unit 4 "Architectural Design" by Adi.pdf
Software Engineering-Unit 4 "Architectural Design" by Adi.pdf
 
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdfSoftware Engineering-Unit 5 "Software Testing"by Adi.pdf
Software Engineering-Unit 5 "Software Testing"by Adi.pdf
 
Computer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. AdiseshaComputer Networks Notes by -Dr. K. Adisesha
Computer Networks Notes by -Dr. K. Adisesha
 
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. AdiaeshaCCN Unit-1&2 Data Communication &Networking by K. Adiaesha
CCN Unit-1&2 Data Communication &Networking by K. Adiaesha
 
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. AdiseshaCCN Unit-3 Data Link Layer by Dr. K. Adisesha
CCN Unit-3 Data Link Layer by Dr. K. Adisesha
 
CCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. AdiseshaCCN Unit-4 Network Layer by Dr. K. Adisesha
CCN Unit-4 Network Layer by Dr. K. Adisesha
 
CCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdfCCN Unit-5 Transport & Application Layer by Adi.pdf
CCN Unit-5 Transport & Application Layer by Adi.pdf
 
Introduction to Computers.pdf
Introduction to Computers.pdfIntroduction to Computers.pdf
Introduction to Computers.pdf
 
R_Programming.pdf
R_Programming.pdfR_Programming.pdf
R_Programming.pdf
 
Scholarship.pdf
Scholarship.pdfScholarship.pdf
Scholarship.pdf
 
Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
 
Operating System-1 by Adi.pdf
Operating System-1 by Adi.pdfOperating System-1 by Adi.pdf
Operating System-1 by Adi.pdf
 
Operating System-adi.pdf
Operating System-adi.pdfOperating System-adi.pdf
Operating System-adi.pdf
 
Data_structure using C-Adi.pdf
Data_structure using C-Adi.pdfData_structure using C-Adi.pdf
Data_structure using C-Adi.pdf
 
JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
 
JAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdfJAVA PPT -5 BY ADI.pdf
JAVA PPT -5 BY ADI.pdf
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

Introduction to 8085 by Adi PPT.pdf

  • 2. Prof. K. Adisesha 2 8085 INTRODUCTION Learning Objective: ➢Basic Concept and Ideas about Microprocessor. ➢Architecture of 8085 ➢Addressing Modes and Instruction set of 8085 ➢Interrupts of 8085 ➢Peripheral Interfacings
  • 3. Prof. K. Adisesha 3 Basic of Microprocessors Differences between: ➢Microcomputer –a computer with a microprocessor as its CPU. Includes memory, I/O etc. ➢Microprocessor –silicon chip which includes ALU, register circuits & control circuits. ➢Microcontroller –silicon chip which includes microprocessor, memory & I/O in a single package.
  • 5. Prof. K. Adisesha 5 Basic of Microprocessors Definition of the Microprocessor: ➢ The microprocessor is a programmable device that takes in numbers, performs on them arithmetic or logical operations according to the program stored in memory and then produces other numbers as a result. ❖ Programmable device: The microprocessor can perform different sets of operations on the data it receives depending on the sequence of instructions supplied in the given program. By changing the program, the microprocessor manipulates the data in different ways. ❖ Instructions: Each microprocessor is designed to execute a specific group of operations. This group of operations is called an instruction set. This instruction set defines what the microprocessor can and cannot do.
  • 6. Prof. K. Adisesha 6 Basic of Microprocessors Inside The Microprocessor: ➢ Internally, the microprocessor is made up of 3 main units. ❖ The Arithmetic/Logic Unit (ALU) ❖ The Control Unit. ❖ An array of registers for holding data while it is being manipulated.
  • 7. Prof. K. Adisesha 7 Basic of Microprocessors Memory: ➢ Memory stores information such as instructions and data in binary format (0 and 1). It provides this information to the microprocessor whenever it is needed. ➢ Memory Map and Addresses. ❖ The registers inside the microprocessor ❖ Read Only Memory (ROM) ❖ Random Access Memory (RAM)
  • 8. Prof. K. Adisesha 8 8085 INTRODUCTION 8085 MP Architecture: ➢ 8-bit general purpose μp ➢ Capable of addressing 64 k of memory ➢ Has 40 pins ➢ Requires +5 v power supply ➢ Can operate with 3 MHz clock ➢ 8085 upward compatible
  • 9. Prof. K. Adisesha 9 8085 INTRODUCTION The features of INTEL 8085 are : ➢It is an 8 bit processor. ➢It is a single chip N-MOS device with 40 pins. ➢It has multiplexed address and data bus.(AD0-AD7). ➢It works on 5 Volt dc power supply. ➢The maximum clock frequency is 3 MHz while minimum frequency is 500kHz. ➢It provides 74 instructions with 5 different addressing modes.
  • 10. Prof. K. Adisesha 10 The features of INTEL 8085 are : ➢It provides 16 address lines so it can access 2^16 =64K bytes of memory. ➢It generates 8 bit I/O address so it can access 2^8=256 input ports. ➢It provides 5 hardware interrupts: TRAP, RST 5.5, RST 6.5, RST 7.5,INTR. ➢It provides Acc ,one flag register ,6 general purpose registers and two special purpose registers(SP,PC). ➢It provides serial lines SID ,SOD. So serial peripherals can be interfaced with 8085 directly. 8085 INTRODUCTION
  • 11. Prof. K. Adisesha 11 PIN DIAGRAM -8085
  • 12. Prof. K. Adisesha 12 PIN DIAGRAM -8085
  • 13. ➢ READY:This an output signal used to check the status of output device.If it is low, µP will WAIT until it is high. ➢ TRAP:It is an Edge triggered highest priority , non mask able interrupt. After TRAP, restart occurs and execution starts from address 0024H. ➢ RST5.5,6.5,7.5:These are maskable interrupts and have low priority than TRAP. ➢ INTR¯&INTA:INTR is a interrupt request signal after which µP generates INTA or interrupt acknowledge signal. ➢ IO/M¯:This is output pin or signal used to indicate whether 8085 is working in I/O mode(IO/M¯=1) or Memory mode(IO/M¯=0 ). Prof. K. Adisesha 13 PIN DIAGRAM -8085
  • 14. ➢ HOLD&HLDA:HOLD is an input signal .When µP receives HOLD signal it completes current machine cycle and stops executing next instruction. In response to HOLD µP generates HLDA that is HOLD Acknowledge signal. ➢ RESET IN¯:This is input signal. When RESET IN¯ is low µp restarts and starts executing from location 0000H. ➢ SID: Serial input data is input pin used to accept serial 1 bit data . ➢ X1X2 :These are clock input signals and are connected to external LC,or RC circuit. These are divide by two so if 6 MHz is connected to X1X2, the operating frequency becomes 3 MHz. ➢ VCC&VSS: Power supply VCC=+ -5Volt& VSS=-GND reference. Prof. K. Adisesha 14 PIN DIAGRAM -8085
  • 15. Prof. K. Adisesha 15 ARCHITECTURE-8085
  • 16. Accumulator: It is 8 bit general purpose register. ◦ It is connected to ALU. ◦ So most of the operations are done in Acc. Temporary register: It is not available for user ◦ All the arithmetic and logical operations are done in the temporary register but user can’t access it. Flag: It is a group of 5 flip flops used to know status of various operations done. ◦ The Flag Register along with Accumulator is called PSW or Program Status Word. Prof. K. Adisesha 16 Arithmetic and Logical group
  • 17. Flag Register is given by: ▪ S: Sign flag is set when result of an operation is negative. ▪ Z: Zero flag is set when result of an operation is 0. ▪ Ac: Auxiliary carry flag is set when there is a carry out of lower nibble or lower four bits of the operation. ▪ CY: Carry flag is set when there is carry generated by an operation. ▪ P: Parity flag is set when result contains even number of 1’s. Rest are don’t care flip flops. S Z X AC X P X CY Prof. K. Adisesha 17 Arithmetic and Logical group
  • 18. Prof. K. Adisesha 18 Register Group
  • 19. ▪ Temporary registers (W,Z):These are not available for user. These are loaded only when there is an operation being performed. ▪ General purpose: There are six general purpose registers in 8085 namely B, C, D, E, H, L. These are used for various data manipulations. ▪ Special purpose :There are two special purpose registers in 8085: ▪ SP :Stack Pointer. ▪ PC: Program Counter. Prof. K. Adisesha 19 Register Group
  • 20. ➢ Stack Pointer: Whenever stack is to be used previous values are PUSHED on stack and then after the program is over these values are POPED back. ➢ Program Counter: It is 16 bit register used to point the location from which the next instruction is to be fetched. ➢ Instruction register: When an instruction is fetched , it is executed in instruction register. This register takes the Opcode value only. ➢ Instruction decoder: It decodes the instruction from instruction register and then to control block. ➢ Timing and control: This is the control section of µP. It accepts clock input . Prof. K. Adisesha 20 Register Group
  • 21. INTERRUPT CONTROL  It accepts different interrupts like TRAP INT5.5, 6.5, 7.5 and INTR. SERIAL IO CONTROL GROUP  It is used to accept the serial 1 bit data by using SID and SOD signals and it can be performed by using SIM & RIM instructions. Prof. K. Adisesha 21 DECODER & CONTROL
  • 22. Prof. K. Adisesha 22 Basic of Microprocessors Machine Language: ➢ The number of bits that form the “word” of a microprocessor is fixed for that particular processor. ➢ These bits define a maximum number of combinations. ❖ For example an 4-bit microprocessor can have at most 24=16 different combinations. ➢ The 8085 (from Intel) is an 8-bit microprocessor. ❖ The 8085 uses a total of 246 bit patterns to form its instruction set. ❖ These 246 patterns represent only 74 instructions. ❖ The reason for the difference is that some (actually most) instructions have multiple different formats. ➢ Because it is very difficult to enter the bit patterns correctly, they are usually entered in hexadecimal instead of binary
  • 23. Prof. K. Adisesha 23 Basic of Microprocessors Assembly Language: ➢ Entering the instructions using hexadecimal is quite easier than entering the binary combinations. but it still is difficult to understand what a program written in hexadecimal does. ➢ So, each company defines a symbolic code for the instructions. ❖ These codes are called “mnemonics”. ❖ The mnemonic for each instruction is usually a group of letters that suggest the operation performed.. ➢ Example: ❖ 00111100 translates to 3C in hexadecimal (OPCODE) ❖ Its mnemonic is: “INR A”. ❖ INR stands for “increment register” and A is short for accumulator.
  • 24. Prof. K. Adisesha 24 Basic of Microprocessors :
  • 25. Prof. K. Adisesha 25 Basic of Microprocessors :
  • 26. Prof. K. Adisesha 26 Basic of Microprocessors :
  • 27. Prof. K. Adisesha 27 Instruction Cycle To execute a program: ➢ The user enters its instructions in binary format into the memory. The microprocessor then reads these instructions and whatever data is needed from memory, executes the instructions and places the results either in memory or produces it on an output device. ➢ To execute a program, the microprocessor “reads” each instruction from memory, “interprets” it, then “executes” it. ➢ To use the right names for the 3 cycles: ❖Instruction Fetch Cycle ❖Instruction Decode Cycles ❖Instruction executes Cycle ➢ This sequence is continued until all instructions are performed.
  • 28. Prof. K. Adisesha 28 Instruction Cycle To execute a program: ➢ To use the right names for the 3 cycles: ❖Instruction Fetch Cycle: ▪ The content of the PC, which is the address memory puts the opcode on the data bus so as to transfer it to the CPU. ▪ The whole operation of fetching an opcode takes three clock cycles. ❖Instruction Decode Cycles: ▪ The opcode fetched from the memory goes to the DR and then to IR. From the IR it goes to the decoder circuitry which decodes the instruction. ❖Instruction executes Cycle: ▪ After the instruction is decoded, execution begins. ▪ The time taken in decoding and execution of an instruction is one clock cycle ➢ This sequence is continued until all instructions are performed.
  • 29. ➢ The µP operates with reference to clock signal. The rise and fall of the pulse of the clock gives one clock cycle. ➢ Each clock cycle is called a T state and a collection of several T states gives a machine cycle. ➢ Important machine cycles are : 1. Op-code fetch. 2. Memory read. 3. Memory write. 4. I/Op-read. 5. I/O write. Prof. K. Adisesha 29 TIMING AND STATE DIAGRAM
  • 30. Basic parameters used Control signal are: ➢ ALE: ALE indicates the availability of a valid address on the multiplexed address/data lines. When it is high or 1, then it acts as an address bus and when low or 0, then it acts as a data bus. ➢ RD (low active): If it is high or 1, then no data is read by the microprocessor. If signal is low or 0, then data is read by the microprocessor. ➢ WR (low active): If it is high or 1, then no data is written by the microprocessor. If signal is low or 0, then data is written by the microprocessor. Prof. K. Adisesha 30 TIMING AND STATE DIAGRAM ➢ IO/M (low active): A high or 1 on this signal indicates I/O operation while a low or 0 indicates memory operation. ➢ S0, S1: S0 and S1 Indicate the type of machine cycle in progress.
  • 31. Op-code Fetch: It basically requires 4 T states from T1-T4 ➢ The ALE pin goes high at first T state always. ➢ AD0-AD7 are used to fetch OP-code and store the lower byte of Program Counter. ➢ A8-A15 store the higher byte of the Program Counter while IO/M¯ will be low since it is memory related operation. ➢ RD¯ will only be low at the Op-code fetching time. ➢ WR¯ will be at HIGH level since no write operation is done. ➢ S0=1,S1=1 for Op-code fetch cycle. Prof. K. Adisesha 31 TIMING AND STATE DIAGRAM
  • 32. Op-code fetch cycle : Prof. K. Adisesha 32 TIMING AND STATE DIAGRAM
  • 33. Memory Read Cycle: Prof. K. Adisesha 33 TIMING AND STATE DIAGRAM
  • 34. Memory Write Cycle: Prof. K. Adisesha 34 TIMING AND STATE DIAGRAM
  • 35. Memory Read Cycle: It basically requires 3T states from T1-T3 ➢ The ALE pin goes high at first T state always. ➢ AD0-AD7 are used to fetch data from memory and store the lower byte of address. ➢ A8-A15 store the higher byte of the address while IO/M¯ will be low since it is memory related operation. ➢ RD¯ will only be low at the data fetching time. ➢ WR¯ will be at HIGH level since no write operation is done. ➢ S0=0,S1=1 for Memory read cycle. Prof. K. Adisesha 35 TIMING AND STATE DIAGRAM
  • 36. Memory write Cycle: It basically requires 3T states from T1-T3 . ➢ The ALE pin goes high at first T state always. ➢ AD0-AD7 are used to fetch data from CPU and store the lower byte of address. ➢ A8-A15 store the higher byte of the address while IO/M¯ will be low since it is memory related operation. ➢ RD¯ will be HIGH since no read operation is done. ➢ WR¯ will be at LOW level only when data fetching is done. ➢ S0=1,S1=0 for Memory write cycle. Prof. K. Adisesha 36 TIMING AND STATE DIAGRAM
  • 37. Classification of instructions based on size of 8085 There are three groups of instructions in 8085 microprocessor based on the length or size of the instruction. They are– ➢Single byte (or 1 byte) instructions ➢Two byte instructions ➢Three byte instructions Prof. K. Adisesha 37 INSTRUCTIONS SET OF 8085
  • 38. Classification of instructions based on size: Single byte instructions. This type of instruction has only Opcode and the operand is specified within the Opcode itself.– ➢Example : i) MOV B, C ii) ADD B Prof. K. Adisesha 38 INSTRUCTIONS SET OF 8085
  • 39. Classification of instructions based on size: Two byte instructions. ➢ This type of instruction has Opcode and one operand. ➢ The first byte represents the Opcode and the second byte represents the 8-bit operand data or 8-bit port address.– ➢Example : i) MVI A, 50H ii) OUT 50H Prof. K. Adisesha 39 INSTRUCTIONS SET OF 8085
  • 40. Classification of instructions based on size: Three byte instructions. ➢ This type of instruction has Opcode and two operands. ➢ The first byte represents the Opcode, the second byte presents the lower order 8-bits of data or address and the third byte represents the higher order 8-bits of data or address.– ➢Example : ) STA 5000H ii) LXI B, 5000H Prof. K. Adisesha 40 INSTRUCTIONS SET OF 8085
  • 41. Classification of instructions based on function The Instruction Set of 8085 can be categorized into five different groups based on the nature of function of the instructions– ➢Data transfer operations ➢Arithmetic operations. ➢Logical operations ➢Branch operations ➢Stack, Input / Output and Machine control operations Prof. K. Adisesha 41 INSTRUCTIONS SET OF 8085
  • 42. DATA TRANSFER GROUP • Using mnemonics without any alteration in the content, data can be transferred in four different cases – ➢From one register to another register ➢From the memory to the register ➢Move Immediate data to Register ➢From the register to the memory Prof. K. Adisesha 42 INSTRUCTIONS SET OF 8085
  • 43. From one register to another register MOV Rd, Rs.(Move data from Rs to Rd). Example: MOV C,B. Move the content of register B to C. Initially After execution B=10H. B=10H. C=20H. C=10H. • Flags Affected :No flags affected. • Addressing mode: Register. Prof. K. Adisesha 43 DATA TRANSFER GROUP
  • 44. From the memory to the register MOV Rd, M (Move data from Memory to Rd). Example: MOV C,M. Move the content of Memory i.e. “H or L” to C. Suppose the Data at memory pointed By HL pair at C200H is 10H. Initially After execution H=C2,L=00,C=30H H=C2,L=00,C=10H. Flags Affected :No flags affected. Addressing mode: Indirect. Prof. K. Adisesha 44 DATA TRANSFER GROUP
  • 45. Prof. K. Adisesha 45 Move Immediate data to Register MVI R, Data.(Move Immediate data to Register). Example: MVI B, 30H. (Move the data 30 H to Register B) Initially After execution B=40H B=30H ◦ Flags Affected :No flags affected. ◦ Addressing mode: Immediate. DATA TRANSFER GROUP
  • 46. LXI Rp,16 bit .(Load 16 bit data to Register pair Immediate). Example: LXI SP, C200H. (Load Stack pointer with C200H). Initially After execution SP=C800H SP=C200H. Flags Affected :No flags affected. Addressing mode: Immediate. Prof. K. Adisesha 46 DATA TRANSFER GROUP
  • 47. From the register to the memory STA address.(Store Acc data to address). Example: STA C200H. (Move the data from Acc to C200H). Suppose in Acc the data is 10H. Initially After execution A=10H, C200=20H C200=10H , A=10H ◦ Flags Affected :No flags affected. ◦ Addressing mode: Direct. Prof. K. Adisesha 47 DATA TRANSFER GROUP
  • 48. LHLD address.(Load HL pair with data from address). Example: LHLD C200H. (Move the data from C200 to HL pair). Suppose at C200 the data is 20H,30H . Initially After execution H=10H,L=20H H=20H,L=30H. C2=20H,00=30H C2=20H,00=30H ◦ Flags Affected :No flags affected. ◦ Addressing mode: Direct. Prof. K. Adisesha 48 DATA TRANSFER GROUP
  • 49. XCHG (Exchange the data from HL pair to DE pair) Example : XCHG Initially After execution H=20H,L=30H, H=40H,L=70H. D=40H,E=70H. D=20H,E=30H. ◦ Flags Affected :No flags affected. ◦ Addressing mode: Register. Prof. K. Adisesha 49 DATA TRANSFER GROUP
  • 50. IN 8 bit address (Move the data from address to Acc) Example: IN 80H Move the data from 80H port address to Accumulator. Suppose data at 80H is 39H. Initially After execution A=20H. A=39H ◦ Flags Affected :No flags affected. ◦ Addressing mode: Direct. Prof. K. Adisesha 50 DATA TRANSFER GROUP
  • 51. OUT 8 bit address (Move the data from Acc to address) Example: OUT 80H Move the data from Acc to port address 80H. Suppose data at Acc is 39H. Initially After execution A=39H, 80=10H. A=39H, 80=39H. ◦ Flags Affected :No flags affected. ◦ Addressing mode: Direct. Prof. K. Adisesha 51 DATA TRANSFER GROUP
  • 52.  Example:  Write a program to exchange contents of memory location D000H to D001H LDA D000H Load Acc with data from D000 MOV B,A Move the data to B LDA D0001H Load Acc with data from D001 STA 2000H Store Acc data at D000 MOV A,B Move B’s data to A STA 2001H Store data from D000 to D0001 RST1 Stop. Prof. K. Adisesha 52 DATA TRANSFER GROUP
  • 53. Prof. K. Adisesha 53 DATA TRANSFER GROUP OPCODE OPERAND EXPLANATION EXAMPLE MOV Rd, Rs Rd = Rs MOV A, B MOV Rd, M Rd = Mc MOV A, 2050 MOV M, Rs M = Rs MOV 2050, A MVI Rd, 8-bit data Rd = 8-bit data MVI A, 50 MVI M, 8-bit data M = 8-bit data MVI 2050, 50 LDA 16-bit address A = contents at address LDA 2050 STA 16-bit address contents at address = A STA 2050 LHLD 16-bit address directly loads at H & L registers LHLD 2050 SHLD 16-bit address directly stores from H & L registers SHLD 2050 LXI r.p., 16-bit data loads the specified register pair with data LXI H, 3050 LDAX r.p. indirectly loads at the accumulator A LDAX H STAX 16-bit address indirectly stores from the accumulator A STAX 2050 XCHG none exchanges H with D, and L with E XCHG PUSH r.p. pushes r.p. to the stack PUSH H POP r.p. pops the stack to r.p. POP H IN 8-bit port address inputs contents of the specified port to A IN 15 OUT 8-bit port address outputs contents of A to the specified port OUT 15
  • 54. Addressing modes in 8085 can be classified into 5 groups: ➢Immediate addressing mode ➢Register addressing mode ➢Direct addressing mode ➢Indirect addressing mode ➢Implied addressing mode Prof. K. Adisesha 54 ADDRESSING MODES OF 8085
  • 55. Immediate addressing: Immediate data is transferred to address or register. Example: MVI A,20H. Transfer immediate data 20H to accumulator. Number of bytes: Either 2 or 3 bytes long. 1st byte is opcode. 2nd byte 8 bit data . 3rd byte higher byte data of 16 bytes. Prof. K. Adisesha 55 ADDRESSING MODES OF 8085
  • 56. Register addressing: Data is transferred from one register to other. Example: MOV A, C :Transfer data from C register to accumulator. Number of bytes: Only 1 byte long. One byte is opcode. Prof. K. Adisesha 56 ADDRESSING MODES OF 8085
  • 57. Direct addressing:  Data is transferred from direct address to other register or vice-versa. Example: LDA C200H .Transfer contents from C200H to Acc. Number of bytes: These are 3 bytes long. 1st byte is opcode. 2nd byte lower address. 3rd byte higher address. Prof. K. Adisesha 57 ADDRESSING MODES OF 8085
  • 58. Indirect addressing: Data is transferred from address pointed by the data in a register to other register or vice-versa. Example: MOV A, M: Move contents from address pointed by M to Acc. Number of bytes: These are 3 bytes long. 1st byte is opcode. 2nd byte lower address. 3rd byte higher address. Prof. K. Adisesha 58 ADDRESSING MODES OF 8085
  • 59. Implied addressing:  These doesn’t require any operand. The data is specified in Opcode itself. Example: RAL: Rotate left with carry. No. of Bytes: These are single byte instruction or Opcode only. Prof. K. Adisesha 59 ADDRESSING MODES OF 8085
  • 60. ADD R (ADD register content with Acc and result in A ). Example: ADD C. (ADD the content of C with A). Suppose the Data at C register is 10H. Initially After execution C= 10H ,A=10H A=20H,C=10H. ◦ Flags Affected : All flags are modified. ◦ Addressing mode: Register Prof. K. Adisesha 60 ARITHMETIC GROUP
  • 61. ADD M(ADD H or L Reg content with Acc and result in A ). Example: ADD M. (ADD the content of HL with A). Suppose the Data at memory pointed by HL register 1020H is 10H. Initially After execution H= 10H ,L=20H . H=10H,L=20H. A=20H,C=10H. A=30H. o Flags Affected :All flags are modified. o Addressing mode: Register Indirect. Prof. K. Adisesha 61 ARITHMETIC GROUP
  • 62. ADI Data (ADD immediate data with Acc and result in A ). Example: ADI 30H. (ADD 30H with A). Initially After execution A=20H, A=50H. ◦ Flags Affected :All flags are modified. ◦ Addressing mode: Immediate. Prof. K. Adisesha 62 ARITHMETIC GROUP
  • 63. ADC R (ADD register content with Acc and carry and result in A ). Example: ADC C. (ADD the content of C with A with carry). Suppose the Data at C register is 10H and carry is 01H. Initially After execution . C= 10H ,A=10H A=21H,C=10H. ◦ Flags Affected :All flags are modified. ◦ Addressing mode: Register Prof. K. Adisesha 63 ARITHMETIC GROUP
  • 64. Example: Write a program to perform 16 bit addition of 1234H & 4321H. Store answer at H & L registers. MVI B,21H B=21H MVI A,34H A=34H MVI C,43H C=43H MVI D,12H D=12H ADD B A=34+21H MOV L,A L=55H MOV A,C A=43H ADC D A=43+12H MOV H,A H=55H RST1 STOP. Prof. K. Adisesha 64 ARITHMETIC GROUP
  • 65. SUB R (Subtract register content from Acc and result in A ). Example: SUB B. (Subtract the content of B from A ). Suppose the Data at B register is 10H . Initially After execution B= 10H ,A=20H A=10H,B=10H. ◦ Flags Affected :All flags are modified. ◦ Addressing mode: Register Prof. K. Adisesha 65 ARITHMETIC GROUP
  • 66. SBB R (Subtract register content from Acc with borrow and result in A ). Example: SBB B. (Subtract the content of B from A with borrow). Suppose the Data at B register is 10H and borrow is 01H . Initially After execution B= 0FH ,A=20H A=10H,B=0FH. ◦ Flags Affected :All flags are modified. ◦ Addressing mode: Register Prof. K. Adisesha 66 ARITHMETIC GROUP
  • 67. SUI Data(Subtract immediate data from Acc and result in A ). Example: SUI 30H. (Subtract 30H from A). Initially After execution A=80H, A=50H. ◦ Flags Affected : All flags are modified. ◦ Addressing mode: Immediate Prof. K. Adisesha 67 ARITHMETIC GROUP
  • 68. Example: Subtract data of C800 H from C200H.Store the result at 2C00. LDA C800H MOV B,A LDA C200H SUB B STA 2C00H RST1 Prof. K. Adisesha 68 ARITHMETIC GROUP
  • 69. DAD Rp (Add specified register pair with HL pair) Example: DAD D.(Add the content of E with L and that of D with H register and result in HL pair)  Suppose the content of HL pair is H=20H ,L=40H and DE pair is D=30H, E=10H. Initially After execution H=20H ,L=40H H=50H ,L=50H D=30H, E=10H D=30H, E=10H ◦ Flags Affected :Only carry flag is modified. ◦ Addressing mode: Register. Prof. K. Adisesha 69 ARITHMETIC GROUP
  • 70. DAA (Decimal adjust accumulator) Example: MVI A,12H ADI 39H DAA . This instruction is used to store result in BCD form.If lower nibble is greater than 9 ,6 is added while if upper nibble is greater than 9,6 is added to it to get BCD result. Initially After execution 12+39=4B 12+39=51 in BCD form. • Flags Affected : All flags are modified. • Addressing mode: Register Prof. K. Adisesha 70 ARITHMETIC GROUP
  • 71. INR R (Increment register content by 1 ). Example: INR C. (Increment the content of C by 1). Suppose the Data at C register is 10H. Initially After execution C= 10H C=11H.  Flags Affected :All flags are modified except carry flag.  Addressing mode: Register. Prof. K. Adisesha 71 ARITHMETIC GROUP
  • 72. DCR R (Decrement register content by 1 ). Example: DCR C. (Decrement the content of C by 1). Suppose the Data at C register is 10H. Initially After execution C= 10H C=0FH.  Flags Affected :All flags are modified except carry flag.  Addressing mode: Register. Prof. K. Adisesha 72 ARITHMETIC GROUP
  • 73. INX Rp (Increment register pair content by 1 ). Example: INX SP (Increment the content of Stack pointer pair by 1). INX B. (Increment the content of BC pair by 1). Suppose the Data at BC register is 1010H and SP is C200H Initially After execution BC= 1010H BC=1011H. SP=C200H SP=C201H.  Flags Affected :No flags are modified.  Addressing mode: Register. Prof. K. Adisesha 73 ARITHMETIC GROUP
  • 74. ANA R (Logically AND register content with Acc and result in A ). Example: ANA C (AND the content of C with A). Suppose the Data at C register is 10H. Initially After execution C= 10H ,A=10H A=10H,C=10H.  Flags Affected :S,Z,P are modified Cy=reset, AC=set.  Addressing mode: Register. Prof. K. Adisesha 74 LOGICAL GROUP
  • 75. ANI Data (Logically AND immediate data with Acc and result in A ) Example: ANI 10H (AND 10H with A). Initially After execution A=10H A=10H ◦ Flags Affected :S,Z,P are modified Cy=reset, AC=set. ◦ Addressing mode: Immediate. Prof. K. Adisesha 75 LOGICAL GROUP
  • 76. ORA R (Logically OR register content with Acc and result in A5 ) Example: ORA C (OR the content of C with A). Suppose the Data at C register is 17H. Initially After execution C= 17H ,A=10H A=17H,C=17H. ◦ Flags Affected :S,Z,P are modified Cy=reset, AC=reset. ◦ Addressing mode: Register. Prof. K. Adisesha 76 LOGICAL GROUP
  • 77. ORI Data (Logically OR immediate data with Acc and result in A ). Example: ORI 10H (OR 10H with A). Initially After execution A=30H A=30H ◦ Flags Affected :S,Z,P are modified Cy=reset,AC=set. ◦ Addressing mode: Immediate. Prof. K. Adisesha 77 LOGICAL GROUP
  • 78. XRA R (Logically XOR register content with Acc and result in A ). Example: XRA C (XOR the content of C with A). Suppose the Data at C register is 17H. Initially After execution C= 17H ,A=10H A=07H,C=17H. ◦ Flags Affected :S,Z,P are modified Cy=reset, AC=reset. ◦ Addressing mode: Register. Prof. K. Adisesha 78 LOGICAL GROUP
  • 79. CMP R (Compare register content with Acc and result in A ). Example: CMP C (Compare the content of C with A). Suppose the Data at C register is 17H. Initially After execution C= 10H ,A=17H A=17H,C=17H. ◦ Flags Affected :S=0,Z=0,P=0, Cy=reset, AC=reset. ◦ Addressing mode: Register. Prof. K. Adisesha 79 LOGICAL GROUP
  • 80. CPI Data (Compare immediate data with Acc ). Example: CPI 10H (Compare the content of C with A). Initially After execution A=17H A=17H. Flags Affected :S=0,Z=0,P=0, Cy=reset,AC=reset. Addressing mode:Immediate. Prof. K. Adisesha 80 LOGICAL GROUP
  • 81. RLC (Rotate accumulator left ). Example: MOV A,03H. RLC (Rotate accumulator left). Initially After execution A=03H A=06H. ◦ Flags Affected :Only carry flag is affected. ◦ Addressing mode: Implied. Prof. K. Adisesha 81 LOGICAL GROUP
  • 82. RAL (Rotate accumulator left with carry ). Example: MOV A,03H. RAL (Rotate accumulator left with carry). Initially After execution A=03H , carry =01H A=07H. Flags Affected :Only carry flag is affected. Addressing mode: Implied. Prof. K. Adisesha 82 LOGICAL GROUP
  • 83. RRC (Rotate accumulator right ). Example: MOV A,03H. RRC (Rotate accumulator right). Initially After execution A=03H , A=81H. ◦ Flags Affected :Only carry flag is affected. ◦ Addressing mode: Implied. Prof. K. Adisesha 83 LOGICAL GROUP
  • 84. Write a program to reset last 4 bits of the number 32H Store result at C200H. MVI A, 32H A=32H ANI F0H 00110010 AND 1111000 =00110000=30H STA C200H. C200=30H RST1 Stop Prof. K. Adisesha 84 LOGICAL GROUP
  • 85. JMP address(Unconditional jump to address) Example: JMP C200H.  After this instruction the Program Counter is loaded with this location and starts executing and the contents of PC are loaded on Stack.  Flags Affected :No Flags are affected.  Addressing mode: Immediate. Prof. K. Adisesha 85 BRANCH GROUP
  • 86. CALL address(Unconditional CALL from address) Example: CALL C200H.  After this instruction the Program Counter is loaded with this location and starts executing and the contents of PC are loaded on Stack. ◦ Flags Affected :No Flags are affected. ◦ Addressing mode: Immediate Prof. K. Adisesha 86 BRANCH GROUP
  • 87. Conditional Jump Instructions. ➢ JC (Jump if Carry flag is set) ➢ JNC (Jump if Carry flag is reset) ➢ JZ (Jump if zero flag set) ➢ JNZ (Jump if zero flag is reset) ➢ JPE (Jump if parity flag is set) ➢ JPO (Jump if parity odd or P flag is reset ) ➢ JP (Jump if sign flag reset ) ➢ JM (Jump if sign flag is set or minus) Prof. K. Adisesha 87 BRANCH GROUP
  • 88. Conditional Call Instructions. ➢ CC (Call if Carry flag is set) ➢ CNC (Call if Carry flag is reset) ➢ CZ (Call if zero flag set) ➢ CNZ (Call if zero flag is reset) ➢ CPE (Call if parity flag is set) ➢ CPO (Call if parity odd or P flag is reset ) ➢ CP (Call if sign flag reset ) ➢ CM (Call if sign flag is set or minus) Prof. K. Adisesha 88 BRANCH GROUP
  • 89. RET (Return from subroutine) Example: MOV A,C RET  After this instruction the Program Counter POPS PUSHED contents from stack and starts executing from that address . Flags Affected :No Flags are affected. Addressing mode:Register indirect . Prof. K. Adisesha 89 BRANCH GROUP
  • 90. RST (Restart instruction) Example: MOV A,C RST 1.  After this instruction the Program Counter goes to address 0008H and starts executing from that address . ◦ Flags Affected :No Flags are affected. ◦ Addressing mode: Register indirect. Prof. K. Adisesha 90 BRANCH GROUP
  • 91. Programming Techniques in 8085: To implement program logic we need to take help of some common Programming Techniques in Microprocessor 8085 such as: ➢ Looping: In this Programming Techniques the Program is instructed to execute certain set of instructions repeatedly to execute a particular task number of times. ➢ Counting: This technique allows programmer to count how many times the instruction/set of instructions are executed ➢ Indexing and code conversion: This Techniques in allows programmer to point or refer the data stored in sequential memory locations one by one. Prof. K. Adisesha 91 Programming Techniques
  • 92. Programming Techniques in 8085: The Program loop is the basic structure which forces the processor to repeat a sequence of instructions. ➢ Loops are of 2 types: ❖Continuous(repeats a task continuously) ❖Conditional(repeats a task until certain data conditions are met) ➢ Loops have four sections.: ❖Initialization section. ❖Processing section. ❖Loop control section ❖Result section. Prof. K. Adisesha 92 Programming Techniques
  • 93. Counters in 8085: This programming technique uses instructions, as loop is established to update count and each count is checked to determine whether it has reached final number and if not reached, then the loop is repeated. ➢ Time Delay: ❖It is a similar programming technique used to set up a counter ❖Register is loaded with a number depending on the time delay required and then register is decremented until it reached zero. ➢ It is achieved by two methods: ❖Using a register ❖Using a register pair. Prof. K. Adisesha 93 Programming Techniques
  • 94. Timer Delay Using Counters: Counting can create time delays. Since the execution times of the instructions used in a counting routine are known, the initial value of the counter, required to get specific time delay can be determined. Prof. K. Adisesha 94 Programming Techniques
  • 95. Timer Delay Using Nested Loops: In this, there are more than one loops. The innermost loop is same as explained above. The outer loop sets the multiplying count to the delays provided by the innermost loop. Prof. K. Adisesha 95 Programming Techniques
  • 96. Timer Delay Using NOP Instruction: NOP instruction does nothing but takes 4T states of processor time to execute. ➢ So by executing NOP instruction in between two instructions we can get delay of 4 T-state. ➢ If the 8085 MPU is working on 6MHz clock frequency, then the internal clock frequency is 3MHz. ➢ To determine that each clock period is 1/3 of a microsecond. ➢ So the NOP will be executed in 1/3 * 4 = 1.333µs. Prof. K. Adisesha 96 Programming Techniques
  • 97. Timers Delay in 8085: In the real time applications, such as traffic light control, digital clock, process control, serial communication, it is important to keep a track with time. ➢ The delay time is given by the total time taken to execute the delay routine. ➢ It can be computed by multiplying the total number of T-states required to execute subroutine and the time for one T-state of the processor. ➢ The time for one T-state of the processor is given by the inverse of the system clock frequency of the processor. ➢ Example: ❖If the 8085 microprocessor has system clock frequency = 2.5 MHz. ❖Then, time for one T-state= 1 / 2.5 x 106 ❖ = 0.4µsec Prof. K. Adisesha 97 Programming Techniques
  • 98. Example Time Delay in 8085: Write a delay routine to produce a time delay of 0.5 mS in 8085 processor-based system whose clock frequency is 3 MHz. ➢ Calculation to find the count value, N: Prof. K. Adisesha 98 Programming Techniques Instruction T-State required Number of times the instruction is executed Total T-States CALL addr16 Loop: MVI D, N DCR D JNZ LOOP RET 18 7 4 10 (or) 7 10 1 1 N times (N-1) times, 1 1 18 x 1 = 18 7 x 1 = 7 4 x N = 4N 10 x (N-1) = 10N - 10 7 x 1 = 7 10 x 1 = 10 TOTAL T-STATES FOR DELAY SUBROUTINE 14N + 32
  • 99. Calculation of Delay using 8 bit counter:  Consider following example: MVI C, count(8 bit) H 7 T states UP DCR C 4 T states JNZ UP 10/7 T RET 10T  Here loop UP is executed (N-1) times.  Thus delay is Td=M+[(count)x N) -3.  Where M= no.of T states outside loop. N=no.of T states inside loop. Prof. K. Adisesha 99 Programming Techniques
  • 100. ➢ Here value of M= 17, N= 14. ➢ The maximum delay will occur if count is 255 or FF H. ➢ Thus Td max =17+[255x14]-3= 3584 T states. ➢ For 0.5 µsec delay for a T state, we get ➢ Td max=0.5 µsec x 3584= 1792 µsec or 1.792 m sec. Prof. K. Adisesha 100 Programming Techniques
  • 101. Code Conversion: This Programming Techniques in Microprocessor 8085 is to translate a number represented using one coding system to another. ➢ The code conversion involves some basic conversions such as: ❖BCD to Binary conversion ❖Binary to BCD conversion ❖BCD to seven segment code conversion ❖Binary to ASCII conversion and ❖ASCII to binary conversion Prof. K. Adisesha 101 Programming Techniques
  • 102. The stack is a reserved area of the memory in RAM where we can store temporary information. Prof. K. Adisesha 102 STACK AND MACHINE CONTROL ➢The stack is a shared resource as it can be shared by the microprocessor and the programmer. ➢The programmer can use the stack to store data. ➢The microprocessor uses the stack to execute subroutines.
  • 103. The stack is an area of memory identified by the programmer for temporary storage of information.  The stack is a LIFO structure. – Last In First Out.  The stack normally grows backwards into memory.  In the 8085, the stack is defined by setting the SP (Stack Pointer) register. • LXI SP, FFFFH Prof. K. Adisesha 103 STACK AND MACHINE CONTROL
  • 104. Saving Information on the Stack.  Information is saved on the stack by PUSHing it on.  It is retrieved from the stack by POPing it off.  The 8085 provides two instructions: ◦ PUSH – This is the instruction we use to write information on the stack. ◦ POP – This is the instruction we use to read information from the stack. Prof. K. Adisesha 104 STACK AND MACHINE CONTROL
  • 105. PUSH Rp. (Push register pair contents on stack). Example: LXI SP FFFFH. PUSH B. (Move the content of BC pair on Stack).  Suppose at HL pair the data is H= 20H,L= 30H & SP is initialized at FFFFH Initially After execution B=12H,C=F3H B=12H,C=F3H. SP=FFFF H FFD=F3H,FFFE=12H ◦ Flags Affected :No flags affected. ◦ Addressing mode: Register indirect. Prof. K. Adisesha 105 STACK AND MACHINE CONTROL
  • 106. POP Rp. (Pop register pair contents from stack). Example: POP D(POP the content of DE pair from Stack).  POP D (1 Byte Instruction)  – Copy the contents of the memory location pointed to by the SP to register E  – Increment SP  – Copy the contents of the memory location pointed to by the SP to register D  – Increment SP  Flags Affected :No flags affected. ◦ Addressing mode: Register indirect Prof. K. Adisesha 106 STACK AND MACHINE CONTROL
  • 107. Saving Information on the Stack.  There are two methods to add data to the stack: ❖Direct method ❖Indirect method  Direct method: The stack pointers address is loaded into the stack pointer register directly.  Indirect method: The stack pointers address is loaded into the stack pointer register via another register pair. Prof. K. Adisesha 107 STACK AND MACHINE CONTROL
  • 108. Saving Information on the Stack.  Direct method: The stack pointers address is loaded into the stack pointer register directly. LXI SP, 8000H LXI H, 1234H PUSH H POP D HLT Prof. K. Adisesha 108 STACK AND MACHINE CONTROL
  • 109. Saving Information on the Stack.  Direct method: The stack pointers address is loaded into the stack pointer register directly. ➢ LXI SP, 8000H – The address of the stack pointer is set to 8000H by loading the number into the stack pointer register. ➢ LXI H, 1234H – Next, we add a number to the HL pair. The most significant two bits will enter the H register. The least significant two bits will enter the L register. ➢ PUSH H – The PUSH command will push the contents of the H register first to the stack. Then the contents of the L register will be sent to the stack. ➢ POP D – The POP command will remove the contents of the stack and store them to the DE register pair. Prof. K. Adisesha 109 STACK AND MACHINE CONTROL
  • 110. Saving Information on the Stack.  Indirect method: The stack pointers address is loaded into the stack pointer register via another register pair. LXI H, 8000H SPHL LXI H, 1234H PUSH H POP D HLT Prof. K. Adisesha 110 STACK AND MACHINE CONTROL
  • 111. Saving Information on the Stack.  Indirect method: The stack pointers address is loaded into the stack pointer register via another register pair. ➢LXI H, 8000H – The number that we wish to enter into the stack pointer, 8000H, is loaded into the HL pair register. ➢SPHL – This is a special command that we can use to transfer data from HL pair to Stack pointer (SP). Now, the contents of the HL pair are in the SP. ➢LXI H, 1234H – Next, we add a number to the HL pair. ➢PUSH H – The PUSH command will push the contents of the H register first to the stack. Then the contents of the L register will be sent to the stack. ➢POP D – The POP command will remove the contents of the stack and store them to the DE register pair. Prof. K. Adisesha 111 STACK AND MACHINE CONTROL
  • 112. XTHL (Exchange HL register pair contents with top of stack). Example: XTHL(Exchange top with HL pair).  Suppose at HL pair the data is H= 20H,L= 30H & SP =FFFFH & at locations FFFF=10H and at FFFE= 80H. Initially After execution H=20H,L=30H H=10H,L=80H. SP=FFFF =10H,FFFE=80H FFFD=20H,FFFE=30H ◦ Flags Affected :No flags affected. ◦ Addressing mode: Register indirect. Prof. K. Adisesha 112 STACK AND MACHINE CONTROL
  • 113. A Subroutine: It is a small program written separately from the main program to perform a particular task that you may repeatedly require in the main program.  The concept of a subroutine is that it is used to avoid the repetition of smaller programs.  Subroutines are written separately and are stored in a memory location that is different from the main program.  You can call a subroutine multiple times from the main program using a simple CALL instruction.  The subroutine can be exited from using a return (RET) instruction. Prof. K. Adisesha 113 SUBROUTINE
  • 114. A Subroutine: in the microprocessor is a sequence of program instructions code that performs a particular task.  A subroutine is a unit which is used in multiple times in different location.  The four types of subroutine have in the microprocessor: ❖Unconditional Call instruction ❖Conditional call instruction ❖Unconditional return instruction ❖Conditional return instruction Prof. K. Adisesha 114 SUBROUTINE
  • 115. Unconditional CALL / RET statements: We can use Unconditional CALL / RET statements, to call a subroutine multiple times from the main program using a simple CALL instruction. Prof. K. Adisesha 115 SUBROUTINE
  • 116. Conditional CALL statements: You can use conditional CALL statements, too, according to your needs. These statements enter a subroutine only when a certain condition is met.  CC Call at address if cy (carry flag) = 1  CNC Call at address if cy (carry flag) = 0  CZ Call at address if ZF (zero flag) = 1  CNZ Call at address if ZF (zero flag) = 0  CPE Call at address if PF (parity flag) = 1  CPO Call at address if PF (parity flag) = 0  CN Call at address if SF (signed flag) = 1  CP Call at address if SF (signed flag) = 0 Prof. K. Adisesha 116 SUBROUTINE
  • 117. Conditional return (RET) statements: You can use conditional RET statements, too, according to your needs. These statements ensure that a subroutine is exited only when a certain condition is met.  RC Return from subroutine if cy (carry flag) = 1  RNC Return from subroutine if cy (carry flag) = 0  RZ Return from subroutine if ZF (zero flag) = 1  RNZ Return from subroutine if ZF (zero flag) = 0  RPE Return from subroutine if PF (parity flag) = 1  RPO Return from subroutine if PF (parity flag) = 0  RN Return from subroutine if SF (signed flag) = 1  RP Return from subroutine if SF (signed flag) = 0 Prof. K. Adisesha 117 SUBROUTINE
  • 118. Advantages of using subroutines: The various advantages of using subroutines are: ➢ Subroutines avoid the repetition of instructions. ➢ They give an aspect of modular programming to the entire program. ➢ Improves efficiency by reducing the size of the memory needed to store the program. Prof. K. Adisesha 118 SUBROUTINE
  • 119. At the time of executing one 8085 program, interruption can be done in the mid-way by the virtue of the program by an Input Output device.  The communication is not done directly with the Input Output device rather done by the virtue of an Input Output port.  The data transfer can be either in two forms: ❖Parallel data transfer ❖Serial data transfer Prof. K. Adisesha 119 Data transfer schemes in 8085
  • 120. For transferring data in parallel we have three different ways by which microprocessor communicates with an Input or Output:.  Basic or simple data transfer scheme: This method is beneficial to us when we have accurate know-ledge of the Input Output device timing characteristics.  Status check data transfer: Status check data transfer process is a much more complex process than simple data transfer.  Interrupt driven data transfer: We use this method when there lacks accurate knowledge of the timing characteristics of the Input Output device which takes maximum time for the device to be ready for use. Prof. K. Adisesha 120 Data transfer schemes in 8085
  • 121.  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.  Classification of Interrupts Interrupts can be classified into two main types: ➢Maskable Interrupts (Can be delayed or Rejected) ➢Non-Maskable Interrupts (Can not be delayed or Rejected) Prof. K. Adisesha 121 INTERRUPTS IN 8085
  • 122.  Interrupt is a process where an external device can get the attention of the microprocessor. Interrupts can be classified into six sub groups: ❖Vector interrupt ❖Non-Vector interrupt ❖Maskable Interrupts ❖Non-Maskable Interrupts ❖Software interrupt ❖Hardware interrupt Prof. K. Adisesha 122 INTERRUPTS IN 8085
  • 123. Interrupts can also be classified into: ➢Vector interrupt − In this type of interrupt, the interrupt address is known to the processor. For example: RST7.5, RST6.5, RST5.5, TRAP. ➢Non-Vector interrupt − In this type of interrupt, the interrupt address is not known to the processor so, the interrupt address needs to be sent externally by the device to perform interrupts. For example: INTR. ➢Maskable interrupt − In this type of interrupt, we can disable the interrupt by writing some instructions into the program. For example: RST7.5, RST6.5, RST5.5. Prof. K. Adisesha 123 INTERRUPTS IN 8085
  • 124. Interrupts can also be classified into: ➢Non-Maskable interrupt − In this type of interrupt, we cannot disable the interrupt by writing some instructions into the program. For example: TRAP. ➢Software interrupt − In this type of interrupt, the programmer has to add the instructions into the program to execute the interrupt. There are 8 software interrupts in 8085, i.e. RST0, RST1, RST2, RST3, RST4, RST5, RST6, and RST7. ➢Hardware interrupt − There are 5 interrupt pins in 8085 used as hardware interrupts, i.e. TRAP, RST7.5, RST6.5, RST5.5, INTA. Prof. K. Adisesha 124 INTERRUPTS IN 8085
  • 125. The 8085 has 5 interrupt inputs. The INTR input. ◦ The INTR input is the only non-vectored interrupt. ◦ INTR is mask-able using the EI/DI instruction pair. RST 5.5, RST 6.5, RST 7.5 are all automatically vectored. ◦ RST 5.5, RST 6.5, and RST 7.5 are all mask-able. TRAP is the only non-mask-able interrupt in the 8085 ◦ TRAP is also automatically vectored. Prof. K. Adisesha 125 INTERRUPTS IN 8085
  • 126. Non vectored interrupts:  The 8085 recognizes 8 RESTART instructions: RST0 - RST7 . Each of these would send the execution to a predetermined hard- wired memory location: Restart Instruction Equivalent to RST0 CALL 0000H RST1 CALL 0008H RST2 CALL 0010H RST3 CALL 0018H RST4 CALL 0020H RST5 CALL 0028H RST6 CALL 0030H RST7 CALL 0038H Prof. K. Adisesha 126 INTERRUPTS IN 8085
  • 127. Interrupt name Mask-able Vectored TRAP No Yes RST 7.5 Yes Yes RST 6.5 Yes Yes RST 5.5 Yes Yes INTR YES NO Prof. K. Adisesha 127 INTERRUPT PRIORITY
  • 128. 128 SOD SDE XXX R7.5 MSE M7.5 M6.5 M5.5 0 1 2 3 4 5 6 7 RST5.5 Mask RST6.5 Mask RST7.5 Mask }0 - Available 1 - Masked Mask Set Enable 0 - Ignore bits 0-2 1 - Set the masks according to bits 0-2 Force RST7.5 Flip Flop to reset Not Used Enable Serial Data 0 - Ignore bit 7 1 - Send bit 7 to SOD pin Serial Out Data •SIM Instruction helps activate a particular interrupt. •It can also mask a maskable interrupt. Prof. K. Adisesha 128 SIM INSTRUCTION
  • 129.  Example: Set the interrupt masks so that RST5.5 is enabled, RST6.5 is masked, and RST7.5 is enabled.  First, determine the contents of the accumulator. - Enable 5.5 bit 0 = 0 - Disable 6.5 bit 1 = 1 - Enable 7.5 bit 2 = 0 - Allow setting the masks bit 3 = 1 - Don’t reset the flip flop bit 4 = 0 - Bit 5 is not used bit 5 = 0 - Don’t use serial data bit 6 = 0 - Serial data is ignored bit 7 = 0 SDO SDE XXX R7.5 MSE M7.5 M6.5 M5.5 0 1 0 0 0 0 0 1 EI ; Enable interrupts including INTR MVI A, 0A ; Prepare the mask to enable RST 7.5, and 5.5, disable 6.5 SIM ; Apply the settings RST masks Prof. K. Adisesha 129 SIM INSTRUCTION
  • 130. Serial Data In RST5.5 Interrupt Pending RST6.5 Interrupt Pending RST7.5 Interrupt Pending 0 - Available 1 - Masked Interrupt Enable Value of the Interrupt Enable Flip Flop SDI P7.5 P6.5 P5.5 IE M7.5 M6.5 M5.5 0 1 2 3 4 5 6 7 RST5.5 Mask RST6.5 Mask RST7.5 Mask } •Since the 8085 has five interrupt lines, interrupts may occur during an ISR and remain pending. •Using the RIM instruction, it is possible to can read the status of the interrupt lines and find if there are any pending interrupts. Prof. K. Adisesha 130 RIM INSTRUCTION
  • 131. 8259 microprocessor is defined as Programmable Interrupt Controller (PIC) microprocessor. ➢ There are 5 hardware interrupts interrupts in 8085. ➢ 8259 combines the multi interrupt input sources into a single interrupt output. Interfacing of single PIC provides 8 interrupts inputs from IR0-IR7. ➢ Features of 8259 PIC microprocessor – ❖ Intel 8259 is designed for Intel 8085 and Intel 8086 microprocessor. ❖ It can be programmed either in level triggered or in edge triggered interrupt level. ❖ We can masked individual bits of interrupt request register. ❖ We can increase interrupt handling capability unto 64 interrupt level by cascading further 8259 PIC. ❖ Clock cycle is not required. Prof. K. Adisesha 131 Programmable Interrupt Controller
  • 132. 8259 microprocessor is defined as Programmable Interrupt Controller (PIC) microprocessor. Prof. K. Adisesha 132 Programmable Interrupt Controller ➢ There are 5 hardware interrupts pins and 2 hardware interrupts in 8085. ➢ Interfacing of 8085 and 8259 increases the interrupt handling capability of 8085 microprocessor from 5 to 8 interrupt levels.
  • 133. Interfacing of 8085 and 8259 increases the interrupt handling capability of 8085 microprocessor from 5 to 8 interrupt levels. Prof. K. Adisesha 133 Programmable Interrupt Controller Working of 8259 with 8085 processor: ➢ First the 8259 should be programmed by sending Initialization Command Word (ICW) ➢ and Operational Command Word (OCW). These command words will inform 8259 about the ➢ following, ➢ Type of interrupt signal (Level triggered / Edge triggered). ❖ Type of processor (8085/8086). ❖ Call address and its interval (4 or 8) ❖ Masking of interrupts.
  • 134. ➢ Generally µP 8085 can address 64 kB of memory . ➢ Generally EPROMS are used as program memory and RAM as data memory. ➢ We can interface Multiple RAMs and EPROMS to single µP . ➢ Memory interfacing includes 3 steps : 1.Select the chip. 2.Identify register. 3.Enable appropriate buffer. Prof. K. Adisesha 134 8085 Peripherals Interfacing
  • 135. Data Transfer Techniques:  parallel data transfer scheme, multiple data bits can be transmitted at the same time.  Thus, for the Intel 8085, 8 bits of data are sent all together using eight parallel lines.  Different types of parallel data transferare: ➢Programmed I/O Data Transfer ➢Interrupt Driven I/O Data Transfer ➢Device or Direct Memory Access (DMA) Data Transfer Prof. K. Adisesha 135 8085 Peripherals Interfacing
  • 136. Programmed I/O Data Transfer:  This method can work under the synchronous and asynchronous mode, depending on the speed and architecture of the I/O devices.  We also prefer this method when there is a small amount of information to be exchanged between the microprocessor and other devices. Example: Computer, printer, etc.  Using the IN and OUT instructions, data transfer is carried out between the microprocessor and I/O devices. Prof. K. Adisesha 136 8085 Peripherals Interfacing
  • 137. Programmed I/O Data Transfer:  Using the IN and OUT instructions, data transfer is carried out between the microprocessor and I/O devices. Prof. K. Adisesha 137 8085 Peripherals Interfacing
  • 138. Interrupt Driven I/O Data Transfer:  Interrupt Driven I/O Data Transfer is a much better option.  Here, no extra time of the microprocessor is wasted in waiting for a response/signal from the external device.  Under this method, the I/O device informs the microprocessor about its readiness, only when it is ready. Prof. K. Adisesha 138 8085 Peripherals Interfacing
  • 139. Direct Memory Access (DMA) Data Transfer:  This is an ideal method used for bulk data transfer of a considerable amount between the microprocessor and the I/O device. It is also considered the fastest data transfer scheme.. Prof. K. Adisesha 139 8085 Peripherals Interfacing
  • 140.  The diagram of 2k interfacing is shown below: A15-A8 Latch AD7-AD0 D7- D0 A7- A0 8085 ALE IO/M RD WR 2K Byte Memory Chip WR RD CS A10- A0 A15- A11 3:8DECODER Prof. K. Adisesha 140 8085 Memory Interfacing
  • 141. ➢ Address lines A0-A10 are used to interface memory while A11,A12,A13,A14,A15 are given to 3:8 Decoder to provide an output signal used to select the memory chip CS¯or Chip select input. ➢ MEMR¯ and MEMW¯are given to RD¯and WR¯pins of Memory chip. ➢ Data lines D0-D7 are given to D0-D7 pins of the memory chip. ➢ In this way memory interfacing can be achieved. Prof. K. Adisesha 141 8085 Memory Interfacing
  • 142. Programmable peripheral interface 8255 ➢ PPI 8255 is a general purpose programmable I/O device to interface the CPU such as ADC, DAC, keyboard etc. ➢ We can program it according to the given condition. It can be used with almost any microprocessor. ➢ It consists of three 8-bit bidirectional I/O ports: ❖PORT A ❖PORT B ❖PORT C ➢ We can assign different ports as input or output functions. . Prof. K. Adisesha 142 8085 Peripherals Interfacing
  • 143. PA0-PA7 I/O Port A Pins PB0-PB7 I/O Port B Pins PC0-PC7 I/O Port C Pins D0-D7 I/O Data Pins RESET I Reset pin RD¯ I Read input WR ¯ I Write input A0-A1 I Address pins CS ¯ I Chip select Vcc , Gnd I +5volt supply Prof. K. Adisesha 143 8255 PIN DIAGRAM
  • 144. Prof. K. Adisesha 144 8255 BLOCK DIAGRAM
  • 145. ➢ Data Bus Buffer: It is an 8 bit data buffer used to interface 8255 with 8085. It is connected to D0-D7 bits of 8255. ➢ Read/write control logic: It consists of inputs RD¯, WR¯, A0, A1, CS¯ . ❖ RD¯,WR¯ :are used for reading and writing on to 8255 and are connected to MEMR¯,MEMW¯ of 8085 respectively. ❖ A0,A1 :are Port select signals used to select the particular port . ❖ CS ¯ :is used to select the 8255 device . ❖ It is controlled by the output of the 3:8 decoder used to decode the address lines of 8085. Prof. K. Adisesha 145 8255 BLOCK DIAGRAM
  • 146. Depending upon the value if CS’, A1 and A0 we can select different ports in 8255. Prof. K. Adisesha 146 8255 BLOCK DIAGRAM ➢ This is done by writing a suitable word in control register (control word D0-D7).
  • 147. Group A and Group B Control: ❖ Group A control consists of Port A and Port C upper. ❖ Group B control consists of Port A and Port C lower. Each group is controlled through software. ➢ They receive commands from the RD¯, WR¯ pins to allow access to bit pattern of 8085. ➢ The bit pattern consists of : 1. Information about which group is operated. 2. Information about mode of Operation. Prof. K. Adisesha 147 8255 BLOCK DIAGRAM
  • 148.  PORT A, B: These are bi-directional 8 bit ports each and are used to interface 8255 with CPU or peripherals. ◦ Port A is controlled by Group A while Port B is controlled by Group B Control.  PORT C: This is a bi-directional 8 bit port controlled partially by Group A control and partially by Group B control . ◦ It is divided into two parts Port C upper and Port C lower each of a nibble.  It is used mainly for control signals and interfacing with peripherals. Prof. K. Adisesha 148 8255 BLOCK DIAGRAM
  • 149.  Mode 0 : Simple I/O • Any of A, B, CL and CH can be programmed as input or output  Mode 1: I/O with Handshake • A and B can be used for I/O • C provides the handshake signals  Mode 2: Bi-directional with handshake • A is bi-directional with C providing handshake signals • B is simple I/O (mode-0) or handshake I/O (mode-1)  BSR (Bit Set Reset) Mode • Only C is available for bit mode access. • Allows single bit manipulation for control applications Prof. K. Adisesha 149 8255 MODES
  • 150.  Thus we get addresses ,considering don’t cares to be zero as Port A =8000H Port B =8001H Port C =8002H CWR =8003H  We give A11,A12,A13 pins to A,B,C inputs of Decoder to enable 8255 or Chip Select.  A15 is logic 1 so it is given to active HIGH G1 pin& A14 ,IO/M ¯ are given to active low G2B ¯,G2A ¯ pins.  Output from Latch is given as A0,A1 pins to 8255 while D0-D7 are given as data inputs. Prof. K. Adisesha 150 INTERFACING 8085 & 8255
  • 151. 8255 8085 3:8 decoder 74373 (AD0-AD7) D7-D0 A0-A7 /CS A0 A1 O0 O1 O7 A13 A12 A11 ALE RD ¯ WR ¯ RD¯ WR¯ G2A G2B G1 A15 A14 IO/M A B C PA PB PC Prof. K. Adisesha 151 INTERFACING 8085 & 8255
  • 152. Prof. K. Adisesha 152 DMA
  • 153.  It is a 4 Channel DMA containing 4 individual I/P ,O/P Channels. CH0,CH1,CH2,CH3  It is compatible with Intel processors.  The maximum frequency is 3 MHz.  It executes 3 cycles: 1.DMA read 2.DMA write. 3.DMA verify.  The external device can terminate DMA Operation Prof. K. Adisesha 153 8257 DMA
  • 154. ➢ Rotating priority mode: Each channel has equal priority. Priority is shifted from one channel to other. ➢ Fixed priority mode: Each channel has a fixed priority and if higher priority channels are busy then smaller priority will get to serve. ➢ Extended write mode: This mode is used to interface slower devices to the system. ➢ TC stop mode: If this bit is set the channel whose terminal count is reached is disabled. ➢ Auto reload mode: If this bit is set data is transferred by channel 2 only. All other channels are not used. Prof. K. Adisesha 154 OPERRATING MODES OF 8257
  • 155. Serial Communications systems are of three types: Simplex: This is a one way communication.  Only one party can speak.  The other party only hears to the first one but cant communicate. System A System B unidirectional Transmitter Receiver Prof. K. Adisesha 155 SERIAL COMMUNICATION
  • 156. System A System B OR Transmi tter/Rec eiver Receiver /Transm itter Half Duplex: It is a two way communication between two ports provided that only party can communicate at a time. • When one party stops transmitting the other starts transmitting. • The first party now acts as a receiver. Prof. K. Adisesha 156 SERIAL COMMUNICATION
  • 157. OR/AND. Full Duplex: It is a two way communication between two ports and both parties can communicate at same time.  Thus here efficient communication can be established. Transmitter/ Receiver Receiver/ Transmitter. Prof. K. Adisesha 157 SERIAL COMMUNICATION
  • 158. Asynchronous Synchronous 1. It transfers one character at a time. 1. It transfers group of characters at a time. 2. Used for transfer data rates <20KBPS 2. Used for transfer data rates >20KBPS 3. Start and stop bit for each character which forms a frame. 3. No start and stop bit for each character. 4. Two Clocks are used for Tx and Rx 4. Single clock is used for both Tx and Rx. Prof. K. Adisesha 158 TRANSMISSION FORMATS
  • 159. Prof. K. Adisesha 159 8253 BLOCK DIAGRAM
  • 160.  Three independent 16 bit counters.  24 pin Dual in line Package.  Counting facility in Both BCD and Binary modes.  Dc to 2 MHz operating Frequency.  Can be used as a clock generator. Prof. K. Adisesha 160 8253 Features
  • 161. Prof. K. Adisesha 161 Feedback