By: Dr. Anil Swarnkar Assistant Professor Department of Electrical Engineering, MNIT, Jaipur
By: Dr. Anil Swarnkar Assistant Professor Department of Electrical Engineering, MNIT, Jaipur
By: Dr. Anil Swarnkar Assistant Professor Department of Electrical Engineering, MNIT, Jaipur
Dr. Anil Swarnkar Assistant Professor Department of Electrical Engineering, MNIT, Jaipur
E-mail id: [email protected] Mobile: 98292-88581
What is Microprocessor
VLSI technology of ICs made it possible to design the complete circuit of ALU (Arithmetic Logic Unit) and CU (Control Unit) within a single chip, which comprises the main processing part, called Central Processing Unit (CPU), of computer system. This chip was named Microprocessor.
Importance of Microprocessors
Microprocessors/microcontrollers are not used only in computer systems but may be used in many control applications and devices used in our daily life. For such applications use of advanced microprocessors may be a costly affair, hence smaller processors like 8085/86, or microcontrollers with limited features may be more suitable and cost effective.
8085 Microprocessor
Accumulator (A)
It is an 8-bit register, which is the most important part of the arithmetic and logic unit (ALU). It is used to store 8-bit data. The results of arithmetical and logical operations are stored in the accumulator. It is also used to receive data from input port to microprocessor and to send data to output port from microprocessor. It is referred as register A in the program.
registers. These registers store 8-bit data temporarily for processing. Some time it is required to store 16-bit data. In 8085 microprocessor, BC, DE and HL are used as register pairs to store 16-bit data. Hence there are 6 general-purpose 8-bit registers and they can be used as 3 pairs as 16-bit registers.
Bus Organisation
There are three sets of busses in 8085microprocessor. Address bus, Data bus and Control bus
of an instruction. Memory Read: Reading data from memory. Memory Write: Writing data into memory. I/O Read: Accepting data from Input Port. I/O Write: Sending data to Output Port.
Status signals
Power supply and clock frequency Interrupt signals
to the microprocessor digital circuit (architecture) - a specific task is performed. The entire group of instructions of particular microprocessor is called its instruction set. In 8085microprocessor each instruction code is of 8-bits (1 byte), hence there may 28 (=256) different binary patterns; therefore total 256 instructions in its instruction set.
Classification of Instructions
Data copy operations
Input/Output operations Arithmetic operations Logical operations Branch operations Machine control operations Stack Operations
register Data from any register to memory Data from memory to any register
Example: MOV B, C
Format 2: MOV M, R From any register to memory. Memory address is specified by the contents of HL pair, i.e. [HL] R Example: MOV M, D
Format 3: MOV R, M From memory to any register, i.e., R [HL] Example: MOV B, M
directly into the register (R) or Memory location specified by HL pair. Format 1: MVI R, 8-bit data Format 2: MVI M, 8-bit data
Example: MVI A, 21H
directly into the register pair (Rp). Format: LXI Rp, 16-bit data
Example: LXI B, 3E21H
register pair (only BC or DE pair) to the Accumulator (A). HL pair cannot be used in this instruction. Format: LDAX Rp
A [Rp]
Example: LDAX B
INPUT/OUTPUT OPERATIONS
IN (Input) instruction IN 8-bit port address OUT (output) instruction OUT 8-bit port address
ARITHMETIC OPERATIONS
ADD instruction ADD R AA+R ADD M A A + [HL] ADI (Add Immediate) instruction ADI 8-bit data A A + (8-bit data) ADC (Add with Carry) instruction ADC R A A + R + CY ADC M A A + [HL] + CY ACI (Add Immediate with Carry) instruction ACI 8-bit data DAD (Double Add) instruction DAD Rp HL HL + Rp
Flags are modified according to the result.
AAR A A [HL]
A A 8-bit data A A (R + Borrow) A A ([HL] + Borrow) A A (data + Borrow)
DCR M
Flags?
LOGICAL OPERATIONS
ANA (Logical AND with Accumulator) instruction
AA&R ANA M A A & [HL] ANI (AND Immediate with Accumulator) instruction ANI 8-bit data A A & (8-bit data)
ANA R
S, Z, and P are modified according to the result. CY is always reset. AC is always set.
AA|R ORA M A A | [HL] ORI (OR Immediate with Accumulator) instruction ORI 8-bit data
ORA R
S, Z, and P are modified according to the result. CY and AC are always reset.
S, Z, and P are modified according to the result. CY and AC are always reset
A A
contents of the Accumulator (A). Actually, the comparison is done by subtracting the contents of the register R from the contents of the Accumulator (A). The contents of the register R and the Accumulator do not change. All flags are modified similar to subtraction.
Compare Instruction
Although, all flags are modified, but the conclusion can be
If A > R; CY and Z flags are reset. If A = R; Z flag is set and CY flag is reset. If A < R; CY is set and Z flag is reset.
Format:
RLC
Format:
RRC
BRANCH OPERATIONS
Jump instructions
Unconditional Jump instruction Format: JMP 16-bit memory address
Conditional Jumps instructions JC (Jump on Carry) JNC (Jump on No Carry) JZ (Jump on Zero) JNZ (Jump on No Zero) JP (Jump on Plus) JM (Jump on Minus) JPE (Jump on Parity Even) JPO (Jump on Parity Odd)
CC (Call on Carry) CNC (Call on No Carry) CZ (Call on Zero) CNZ (Call on No Zero) CP (Call on Plus) CM (Call on Minus) CPE (Call on Parity Even) CPO (Call on Parity Odd)
Format:
RET
RST
PCHL (Load PC with HL) instruction Format: PCHL This is a special instruction, which copies the contents of HL register pair into the Program Counter (PC) register. Hence the program execution is transferred to the memory location specified by HL register pair.
STACK OPERATIONS
Initialise Stack Pointer
LXI SP, 16 bit
PUSH instruction
PUSH Rp PUSH PSW
POP instruction
POP Rp POP PSW
INSTRUCTION SIZE
According to the size 8085 instructions are classified into following three groups:
One Byte Instructions
OPCODE FORMAT
The instructions, which use registers or register pairs as their operands, have following codes somewhere in their opcode byte.
Registers B C D E
H L A M (memory)
Codes 00 01 10 11
MOV instruction
Opcode format of MOV instruction is as follows:
MOV
Rd,
Rs
Source Registers D E H 42 43 44 4A 4B 4C 52 53 54 5A 5B 5C 62 63 64 6A 6B 6C 72 73 74 7A 7B 7C
L 45 4D 55 5D 65 6D 75 7D
M 46 4E 56 5E 66 6E 7E
A 47 4F 57 5F 67 6F 77 7F
Destination Registers
ADDRESSING MODES
Register Addressing MOV C, B Immediate Addressing MVI A, 33H Direct Addressing STA 3050H Indirect Addressing MOV B, M
MVI B, 30H
2006H 2007H
01H 76H
Add contents of register B with A and store the result in A. Send the contents of A to output port 01H. Stop the program.
Write an assembly language program to add two 8-bit numbers stored in register A and register B. Store the result at the memory location 3000H using STA instruction.
Memory Address 2000H 2001H 2002H 2003H 2004H Mnemonics Hex Code 3EH 20H 06H 30H 80H
Remarks
Store 20H in register A. Store 30H in register B. Add contents of register B with A and store the result in A. Store the contents of A (i.e. result) at the memory location 3000H. Stop the program.
STA 3000H
HLT
What is Masking? Assume that 37H is stored in the Accumulator. Mask high-order 4-bits of the given data and display the result on the output port 02H.
Memory Address Mnemonics Hex Code
Remarks
2000H
2001H 2002H 2003H
MVI A, 37H
ANI 0FH
3EH
37H E6H 0FH
2004H
2005H 2006H
OUT 02H
HLT
D3H
02H 76H
Add two 8-bit numbers stored in memory location 2050H and 2051H and store the result at memory location 2052H.
Memory Address 2000H 2001H 2002H 2003H 2004H Mnemonics LXI H, 2050H Hex Code Remarks 21H 50H 20H 7EH 23H Load memory address of the first number in HL register pair.
MOV A, M INX H
HLT
Copy first number into A. Increment the contents of HL pair. HL pair now pointing to second number. Add first & second numbers. Store the result at memory location 2052H.
Stop the program.
Write an assembly language program to find the largest of three numbers stored in the memory location 2050H, 2051H and 2052H, assuming that all three numbers are unequal.
START
Read A, B, C
Yes (CY=0)
A>B?
No (CY=1)
No (CY=1)
No (CY=1)
Display A
Display C
Display B
STOP
Write an assembly language program to find the largest of the given list of n data bytes stored in the memory starting from memory location 2071H. Count of data bytes in the list (i.e. n) is stored at memory location 2070H.
START Initialise Memory Pointer Initialise Counter C A=0
A>B?
Yes No
Decrement Counter C
C=0?
STOP
Label
Remarks Initialise the HL register pair with the memory address 2070H of the count.
2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH SKIP: LOOP:
70H 20H 4EH AFH 23H 46H B8H D2H 0CH 20H 78H 23H
Copy count from memory to register C. Clear the Accumulator, which will store the largest number. Increment memory pointer to address 2071H, which is the address of the first number. Copy number stored at address pointed by HL. Compare A with B. All flags are modified. If Carry flag is not set (B<A) then goto memory location 200CH.
MOV A, B INX H
If B>A. Store larger number in A. Increment memory pointer to the address of the next number. Decrement the counter. Repeat the process from location 2006H if counter is not zero.
200DH
200EH 200FH 2010H 2011H 2012H 2013H
DCR C
JNZ LOOP
0DH
C2H 06H 20H D3H 01H 76H
OUT 01H
HLT
When counter reaches zero. Loop is terminated. A contains the largest number, which is displayed at Port 01H. Stop the program.
Write an assembly language program to add the given list of n data bytes stored in the memory starting from memory location 3000H. Store the 8-bit sum in the memory location 3050H. Where n may be any number but for this case choose n=10.
Memory Label Address 2000H Mnemonics LXI H, 3000H Hex Code 21H
Remarks
Store the starting address of the list of data bytes in HL register pair.
MVI C, 0AH
Clear Accumulator. Add the data stored at memory location pointed by HL pair with A. Increment the memory pointer. Now, pointing to the next number. Decrement the counter. Repeat the process, until the conter is zero.
STA 3050H
HLT
Write an assembly language program to add the given list of n data bytes stored in the memory starting from memory location 3050H. Store the 16bit sum in the memory location 3070H (lower byte) and 3071H (higher byte). Where n may be any number but for this case choose n=25.
Memory Address 2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 2016H 2017H 2018H Label Mnemonics LXI H, 3050H Hex Code 21H 50H 30H 0EH 19H AFH 47H 86H D2H 0CH 20H 04H 23H 0DH C2H 07H 20H 32H 70H 30H 78H 32H 71H 30H 76H Remarks Store the starting address of the list of data bytes in HL register pair.
MVI C, 19H
Clear the Accumulator. (A=00H) Clear the register B. (B=00H). Add the data stored at memory location pointed by HL pair with A. If Carry flags is not set, goto memory location 200CH.
SKIP:
If Carry flag is set, B is incremented by one. Increment the memory pointer. Now, pointing to the next number. Decrement the counter. Repeat the process, until the conter is zero.
STA 3070H
Store the low-order byte of the sum (available in A) at memory location 3070H.
Copy high-order byte of the sum to A. Store the high-order byte of the sum at memory location 3071H.
HLT
Write an assembly language program to add the set of data bytes stored in the memory starting form 2050H. The end of data string is indicated by 00H. Result may be larger than FFH. Display the sum at port 1 and port 2.
Memory Address 2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 2016H Label Mnemonics LXI H, 2050H Hex Code 21H 50H 20H AFH 4FH 7EH FEH 00H CAH 15H 20H 81H D2H 10H 20H 14H 4FH 23H C3H 05H 20H 78H D3H Remarks Store the starting address of the list of data bytes in HL register pair.
LOOP:
Clear the Accumulator. (A=00H) Clear the register C. (C=00H). Read first number in the Accumulator. Check whether the number is 00H or not. If it is 00H then goto 2015H to display the sum.
Otherwise Add the number in A with previous sum in C. Result is stored in A. If Carry flags is not set, goto memory location 200CH.
SKIP:
If Carry flag is set, B is incremented by one. Save the low-order sum in C. Increment the memory pointer. Now, pointing to the next number. Repeat the process.
DISPLAY:
Copy high-order sum in A. Display it at PORT 1. Copy low-order sum in A. Display it at PORT 2. Stop the program.
Write an assembly language program to find the sum of positive numbers only and ignore negative numbers from the list of numbers. The length of the list is in memory location 2050H and the series itself begins from memory location 2051H. Store the 8-bit sum at the memory location 3070H.
Memory Address 2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 2016H 2017H 2018H REJECT: LOOP: Label Mnemonics LXI H, 2050H Hex Code 21H 50H 20H 4EH AFH 47H 23H 7EH 07H DAH 0EH 20H 0FH 80H 47H 23H 0DH C2H 06H 20H 78H 32H 70H 30H 76H Remarks Initialise Memory Pointer with the memory address of the count.
Store Count in C. Clear Accumulator. Clear B, which will be used to store the sum. Increment memory pointer. Copy data stored in the memory location pointed by HL register pair into A. Rotate Accumulator Left to put D7 bit in Carry flag. If Carry flag is set by RLC instruction, i.e., the number in Accumulator was negative. Reject the number and jump to 200EH.
If Carry flag is not set. Rotate right the Accumulator to get the original number in the Accumulator. Add the positive number with the previous sum stored in B. Store the new sum in B Increment the memory pointer. Decrement counter. Repeat the process from 2007H, until counter reaches zero.
Copy the final sum from B to A. Store the contents of A in memory location 3070H.
HLT
Write an assembly language program to copy a block of data bytes from one memory location starting from 2051H to another section of memory starting from 3051H. Number of bytes to be copied is given at memory location 2050H.
Memory Address 2000H Label Mnemonics LXI H, 2050H Hex Code 21H Remarks Initialise memory pointer with the address of the memory location where the count is stored.
LXI D, 3051H
2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H LOOP:
51H 30H 4EH 23H 7EH 12H 23H 13H 0DH C2H 08H 20H 76H
Store the count from memory location pointed by HL pair to C. Increment memory pointer; now pointing to starting memory address of the source. Copy source data from the memory location pointed by HL pair into A. Copy data in A to destination memory location pointed by DE pair. Increment source address. Increment destination address. Decrement counter. Repeat the process from 2008H, until counter reaches zero.
HLT
Write an assembly language program to exchange a block of data bytes stored in the memory starting from 2051H with a block of data bytes stored at another section of memory starting from 3051H. Number of bytes to be exchanged is given at memory location 2050H.
Memory Address 2000H Label Mnemonics LXI H, 2050H Hex Code 21H Remarks Initialise memory pointer with the address of the memory location where the count is stored.
LXI D, 3051H
2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH LOOP:
51H 30H 4EH 23H 7EH 47H 1AH 77H 78H 12D
Store the count from memory location pointed by HL pair to C. Increment memory pointer; now pointing to starting memory address of the source. Read source data into A. Save it in B. Read destination data in A. Store destination data at source location pointed by HL pair. Get source data in A. Store source data at destination location pointed by DE pair.
Increment source pointer. Increment destination pointer. Decrement counter. Repeat the process from 2009H, until counter reaches zero.
HLT
Write an assembly language program for shifting of block of data from memory locations 3000H 3009H to new memory locations 3050H 3059H in reverse order. i.e., data from 3000H will be moved to 3059H and so on.
Memory Address 2000H Label Mnemonics Hex Code 21H Remarks
LXI H, 3000H
Initialise the source pointer (i.e., HL pair) with the starting address of the source data
LXI D, 3059H
Initialise destination pointer (i.e., DE pair) with the last address of the destination
MVI C, 0AH
2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H
LOOP:
0AH 7EH 12H 23H 1BH 0DH C2H 08H 20H 76H
Read the source data from the memory location pointed by HL pair. Store at destination address pointed by DE pair. Increment source pointer. Decrement destination pointer. Decrement counter. Repeat the process from 2008H, until counter reaches zero.
HLT
Write an 8085 assembly program to check if the Input string of characters (in ASCII codes) stored at location 2050H to 205FH is equal to a string stored at location 2100H to 210FH (in ASCII codes). If two strings are same, display 1 at Port 1, otherwise 0.
Memory Address 2000H Label Mnemonics LXI D, 2050H Hex Code 11H Remarks Initialise DE pair with the starting address of first data set.
LXI H, 2100H
MVI C, 10H
MVI B, 00H
LOOP:
Read data of the first set from the memory location pointed by DE pair into A. Compare data in A with respective data of the second set pointed by HL pair. If Zero flag is not set, i.e., data does not match then jump to 2017H, where 00H from B is copied to A and displayed.
Otherwise increment HL pair. Increment DE pair. Decrement counter. Repeat the process from 200AH, until counter reaches zero.
MVI B, 01H
EXIT:
Write an assembly language program to search a data byte, stored at memory location 3000H in the list of 100 data bytes stored in the memory starting from location 3001H. If the data byte is found, display 01H and if not found display 00H, on the output port 82H.
Memory Address 2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H Label Mnemonics LXI H, 3000H Hex Code 21H 00H 30H 7EH 06H 01H 0EH 64H 23H BEH CAH 14H 20H 23H 0DH C2H 09H 20H 06H 00H 78H
Remarks
HL pair is initialised with the memory address 3000H, where the data byte to be searched is stored.
Copy the data byte to be searched into A. Store 01H in B. Register B is used to store the value to be displayed.
MVI C, 64H
Initialise the counter with 64H (=100 in decimal) as given in the question. Increment the memory pointer; now pointing to first data in the list. Compare the data byte to be searched (in A) with data in the list at memory location pointed by HL pair. If zero flag is set, i.e., match is found, then stop the comparison and jump to memory location 2014H. Otherwise increment HL pair. Decrement counter Repeat the process from 2009H, until counter reaches zero.
LOOP:
MVI B, 00H
Store 00H in B.
END:
MOV A, B
2015H
2016H 2017H
OUT 82H
HLT
D3H
82H 76H
Write a program to multiply two 8-bit numbers. Multiplicand is extended to 16-bit and stored in the two consecutive memory locations 2050H and 2051H. The multiplier is stored at 2052H. Store the 16-bit product at two consecutive memory locations 2053H and 2054H.
Memory Address 2000H 2001H 2002H 2003H 2004H Label Mnemonics LHLD 2050H Hex Code 2AH 50H 20H EBH 3AH Remarks Load HL pair with 16-bit multiplicand stored at 2050H and 2051H.
Exchange the contents of HL with DE pair. Multiplicand is now in DE pair. Load 8-bit multiplier into Accumulator.
LXI H, 0000H
2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 2016H 2017H 2018H 2019H
MVI C, 08H
00H 00H 0EH 08H 29H 17H D2H 12H 20H 19H 0DH C2H 0CH 20H 22H 53H 20H 76H
LOOP:
Add HL with HL to shift the contents of HL left by one position. Shift the contents of Accumulator left by one position. If Carry flag is not set skip following DAD D instruction.
SKIP:
DAD D DCR C
JNZ LOOP
SHLD 2053H
HLT
Write an assembly language program to divide a 16-bit dividend, stored in memory locations 2051H & 2052H, by an 8-bit divisor, stored in memory location 2053H. After division the quotient must be stored in memory location 2054H and remainder in memory location 2055H.
Memory Address 2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 2016H 2017H 2018H Label Mnemonics LHLD 2051H Hex Code 2AH 51H 20H 3AH 53H 20H 47H 0EH 08H 29H 7CH 90H DAH 0FH 20H 67H 2CH 0DH C2H 09H 20H 22H 54H 20H 76H
Remarks
Load 16-bit dividend in HL register pair from the memory locations 2051H & 2052H
LDA 2053H
LOOP:
Shift Dividend and quotient left by one position. Copy high-order byte of the dividend in A Subtract divisor form high-order byte of the dividend. If high-order byte of the dividend is less than divisor then go to 200FH.
Otherwise copy high-order into H. Increment the quotient by one. Decrement the count. Repeat the process from 2009H, until counter reaches zero.
SKIP:
SHLD 2054H
HLT
Write an assembly language program to perform addition of two Hexadecimal Numbers as given below: 9A5B8938H & 8BC34AD1H
Memory Address 2000H 2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H Label Mnemonics LXI H, 3000H Hex Code 21H 00H 30H 11H 50H 30H 0EH 04H AFH 1AH Remarks Load starting address of the first set of bytes in HL register pair.
LXI D, 3051H
Load the counter with 4, as 4 bytes in each number given in the question. Clear the Accumulator and Carry Flag. Load accumulator with the first byte of the second number, stored in the memory location pointed by DE pair. Add Accumulator with the first byte of the first number with carry. Store the result in the memory pointed by the HL pair. Overwriting the first number. Increment the memory pointer of the first number. Increment the memory pointer of the second number. Decrement the counter. Repeat the process from 2009H, until counter reaches zero. Stop the program.
LOOP:
HLT
Write an assembly language program to sort the list of bytes, in ascending order, stored in the memory starting from 2061H. The count of the bytes in the list is stored at memory location 2060H.
Memory Address 2000H
2001H 2002H 2003H 2004H 2005H 2006H 2007H 2008H 2009H 200AH 200BH 200CH 200DH 200EH 200FH 2010H 2011H 2012H 2013H 2014H 2015H 2016H 2017H 2018H 2019H 201AH 201BH 201CH 201DH 201EH CHECK: DOPASS:
Label
Mnemonics
LXI H, 2060H
Remarks
Load the HL pair with the memory address where the count of the list is stored.
Store the count in C (counter 1). Decrement Counter 1. Initialise HL pair with the memory address of the first number in the list.
Copy counter 1 into counter 2. Read one number into the accumulator. Increment HL pair pointing to next number in the list. Copy next number in register B. Decrement HL register pair to get the previous address. Compare two adjacent numbers. If later number is smaller, then no swap.
Swapping.
NOSWAP:
Decrement counter 2. Repeat process from 2009H, until counter 2 is not zero.
Decrement counter 1. Repeat for next pass, until counter 1 is not zero.
HLT
Stack
Stack is a part of Read/Write memory (RAM) used to store data or binary information temporarily during the execution of the program. The part of the R/W memory, used as a stack, is defined by the programmer. It works on the concept of Last In Fist Out (LIFO).
PUSH PSW
Subroutine
A subroutine is a sub-program (or set of instructions) to perform a specific task, which is written separately from the main program but may be used once or more than once by the main program.
Subroutine once written may also be used in any program.
Conditional Return RC & RNC RZ & RNZ RP & RM RPE & RPO
Machine Cycle Time required to complete one operation of accessing memory, I/O, or acknowledge an external request is defined as Machine cycle or Machine Operation. One machine cycle may have 3 to 6 TStates. Various machine cycles in 8085microprocessor are:
Opcode Fetch Memory Read Memory Write Input/Output Read Input/Output Write Interrupt Acknowledge Halt Hold Reset
Instruction Cycle Time required to complete the execution of an instruction is defined as Instruction Cycle. One instruction cycle consists of 1 to 6 machine cycles in 8085-microprocessor.
Time Delay
There are two main techniques for providing timedelay:
Software technique Hardware technique (using Intel 8253/8254)
The disadvantages of Software Tech. are: Not accurate. The time delay depends on the T-states of instructions used. Hence cannot be used in real time applications. Misuse of microprocessor. The microprocessor is busy in simply decrementing the register. Calculation of time-delay is tedious. Hardware technique requires additional hardware, i.e., Intel 8253 or 8254 (Programmable Interval Timer). The only disadvantage of this technique is the additional cost for the extra chip. The advantages are More accurate, hence can be used for real time application. Microprocessor is free to perform other function.
If the clock frequency of the system is (f) = 2 MHz The Clock period (T) = 1/f = 1/3 x 10-6 = 0.33 s
Time delay to execute the statement outside loop, i.e., MVI instruction DO= 7 T-states x 0.33 s = 2.31 s Time delay to execute the loop (DL) Time period (T) = 0.33 s
Loop T-states instruction)
= Time period (T) x Loop T-states x Number loaded in the register in decimal
Number loaded in the register = FFH = 25510 Hence, DL = 0.33 x 14 x 255 = 1178.1 s 1.2 ms Actual Time delay in loop: DLA = DL (3 T-states x T) = 1178.1 s 3 x 0.33 = 1177.11 s Hence total delay = DO + DLA = 2.31 s + 1177.11 s = 1179.42 s 1.2 ms
Interfacing Memory
Primary Memory ROM RAM (R/W) Secondary Memory Hard Disk CD etc.
Register Addresses
Registers A3 CS Chip 0 R0 R1 R2 R3 R4 R5 R6 R7 Chip 1 R0 R1 R2 R3 R4 R5 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 A2 A1 Register Select 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 A0 Address in Hexadecimal =00H =01H =02H =03H =04H =05H =06H =07H =08H =09H =10H =11H =12H =13H
R6
R7
1
1
1
1
1
1
0
1
=14H
=15H
Interfacing of 8085 with a memory chip of 256 registers: addresses rage from 0000H to 00FFH
unique output pulse IOSEL, as in the above two examples (Ex. 7.3 and Ex. 7.4), in which the Input/Output device is selected only with one particular address, called Absolute Decoding. Such decoding requires more hardware, hence costly. To reduce the hardware cost, only few address lines (not all 8) may be used for decoding. This type decoding is called Multiple-Address Decoding, as the used Input/Output device will have multiple addresses.
Interrupts
Software Interrupts RST0, RST1, ., RST7 Hardware Interrupts TRAP (non-maskable, Vectored) RST7.5, RST6.5, RST5.5 (Maskable, Vectored) INTR (Maskable, non-Vectored)
RST0 RST1
C7H CFH
0000H 0008H
RST2
RST3 RST4
D7H
DFH E7H
0010H
0018H 0020H
RST5
RST6 RST7
EFH
F7H FFH
0028H
0030H 0038H
Hardware Interrupts
Hardware Interrupts Call Locations Priority Trigger Level
1 4 3 2 5