deepak.p microprocessors and applications mr. deepak p. associate professor ece department sngce 1
TRANSCRIPT
![Page 1: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/1.jpg)
DEEPAK.P
MICROPROCESSORS AND APPLICATIONS
Mr. DEEPAK P.
Associate Professor
ECE Department
SNGCE
1
![Page 2: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/2.jpg)
DEEPAK.P
UNIT 2
2
![Page 3: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/3.jpg)
8085 PROGRAMMING MODEL
DEEPAK.P3
1/8/14
![Page 4: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/4.jpg)
Overview: 8085 Programming model 1. Six general-purpose Registers2. Accumulator Register3. Flag Register4. Program Counter Register5. Stack Pointer Register
![Page 5: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/5.jpg)
Programming Model
5 DEEPAK.P
![Page 6: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/6.jpg)
Programming Model
6 DEEPAK.P
![Page 7: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/7.jpg)
Instruction & Data Formats
DEEPAK.P7
1/8/14
![Page 8: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/8.jpg)
Instruction & Data Formats
8085 Instruction set can be classified according to size (in bytes) as
1. 1-byte Instructions2. 2-byte Instructions3. 3-byte Instructions
1.Includes Opcode and Operand in the same byte2.First byte specifies Operation Code Second byte specifies Operand3.First byte specifies Operation Code Second & Third byte specifies Operand
![Page 9: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/9.jpg)
Instruction & Data Formats
1. 1-byte InstructionsEg. MOV A, M, CMA, DAA etc
2. 2-byte InstructionsEg. MVI A, 08, IN 02, CPI 03 etc
3. 3-byte InstructionsEg. LXI H, 4500, STA 4600, LDA 4200
![Page 10: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/10.jpg)
ADDRESSING MODES
DEEPAK.P10
1/8/14
![Page 11: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/11.jpg)
Addressing Modes of 8085
The microprocessor has different ways of specifying the data or operand for the instruction.
The various formats of specifying operands are called addressing modes
The 8085 has Five addressing modes:
1) Register Addressing mode: This type of addressing mode specifies register or register pair that contains data.
Example: ADD B, MOV B A
![Page 12: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/12.jpg)
Addressing Modes of 8085
2) Immediate Addressing Mode:
In this type of addressing mode, immediate data byte is provided with the instruction.
Example: MVI A 47H, LXIH, 4100H etc.
![Page 13: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/13.jpg)
Memory AddressingOne of the operands is a memory locationDepending on how address of memory
location is specified, memory addressing is of two typesDirect addressingIndirect addressing
3) Direct Addressing Mode: In this type of addressing mode, the 16bit memory address is directly provided with the instruction.
Example: LDA C5 00 , STA 3050H etc
![Page 14: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/14.jpg)
Addressing Modes of 8085
4) Indirect Addressing Mode: In this type of addressing mode, the 16bit memory address is indirectly provided with the instruction using a register pair
Example: LDAX B(Load the accumulator with the contents
of the memory location whose address is stored in the register pair BC)
MOV M, A ;copy register A to memory location whose address is stored in register pair HL
30HA 20H
H
50H
L
30H2050H
![Page 15: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/15.jpg)
Addressing Modes of 8085
5) Implied Addressing mode: In this type of addressing mode, No operand (register or data) is specified in the instruction.
The operand is inborn to the instruction.
Example: CMA (Complement Accumulator) , SIM , RIM etc
![Page 16: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/16.jpg)
INSTRUCTION SET
DEEPAK.P16
1/8/14
![Page 17: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/17.jpg)
Instruction Set of 8085 Consists of
74 operation codes, e.g. MOV, MVI 246 Instructions, e.g. MOV A,B, MVI A,03
8085 instructions can be classified as
1. Data Transfer (Copy) 2. Arithmetic3. Logical and Bit manipulation4. Branch5. Machine Control
![Page 18: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/18.jpg)
Data Transfer Instruction
MOV MoveMVI Move ImmediateLDA Load Accumulator Directly from MemorySTA Store Accumulator Directly in MemoryLHLDLoad Hand L Registers Directly from MemorySHLDStore Hand L Registers Directly in MemoryLXI Load register pair ImmediateLDAXLoad accumulator indirectSTAXStore Accumulator In directXCHG Exchange DE pair and HL pair XTHL Exchange between HL pair and stack
![Page 19: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/19.jpg)
Data Transfer Instruction
![Page 20: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/20.jpg)
Data Transfer InstructionsIN portaddri.e. IN 00 ( Reads data from the Input Switch,
0 0represents the port address of the input switch)
OUT portaddri.e. OUT 00 ( Writes data to the Display device
where 00 represents the Port address of the display)
![Page 21: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/21.jpg)
Data Transfer InstructionsThe 256 input/output ports provide
communication with the outside world of peripheral devices.
The IN and OUT instructions initiate data transfers.
The I N instruction latches the number of the desired port onto the address bus. As soon as a byte of data is returned to the data bus latch, it is transferred into the accumulator.
The OUT instruction latches the number of the desired port onto the address bus and latches the data in the accumulator onto the data bus.
![Page 22: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/22.jpg)
Arithmetic InstructionsADD Add to Accumulator
ADI Add Immediate Data to Accumulator
ADC Add to Accumulator Using Carry Flag
ACI Add Immediate Data to Accumulator Using Carry Flag
SUB Subtract from Accumulator
SUI Subtract Immediate Data from Accumulator
![Page 23: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/23.jpg)
Arithmetic InstructionsSBB Subtract from Accumulator Using
Borrow ((:Carry) FlagSBI Subtract I mmediate from
Accumulator Using BorrowINR Increment Specified Byte by OneDCR Decrement Specified Byte by OneINX Increment Register Pair by OneDCX Decrement Register Pair by OneDAD Double Register Add: Add Contents of
Register Pair to Hand L Register Pair
![Page 24: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/24.jpg)
Arithmetic Instructions
![Page 25: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/25.jpg)
Logical InstructionsANA Logical AND with AccumulatorANI Logical AND with Accumulator Using
Immediate DataORA Logical OR with AccumulatorORI Logical OR with Accumulator Using
Immediate DataXRA Exclusive Logical OR with
AccumulatorXRI Exclusive OR Using Immediate
DataCMP CompareCPI Compare Using Immediate Data
![Page 26: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/26.jpg)
Logical InstructionsRLC Rotate Accumulator LeftRRC Rotate Accumulator RightRAL Rotate Left Through CarryRAR Rotate Right Through CarryCMA Complement AccumulatorCMC Complement Carry FlagSTC Set Carry Flag
![Page 27: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/27.jpg)
Logical Instructions
![Page 28: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/28.jpg)
Logical Instructions
![Page 29: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/29.jpg)
Logical Instructions
![Page 30: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/30.jpg)
Logical Instructions
![Page 31: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/31.jpg)
Branching InstructionsThe unconditional branching instructions are
as follows:JMP JumpCALL CallRET ReturnConditional branching instructionsjumps Calls ReturnsJC CC RC (Carry)JNC CNC RNC (No
Carry)JZ CZ RZ (Zero)JNZ CNZ RNZ (Not
Zero)
![Page 32: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/32.jpg)
Branching InstructionsJP CP RP (Plus)JM CM RM (Minus)JPE CPE RPE (Parity
Even)JPO CPO RPO (Parity
Odd)PCHL Move Hand L to Program CounterRST Special Restart Instruction
Used with Interrupts
![Page 33: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/33.jpg)
Jump Instructions
![Page 34: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/34.jpg)
Call Instructions
![Page 35: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/35.jpg)
Return Instructions
![Page 36: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/36.jpg)
Re start Instructions
![Page 37: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/37.jpg)
Stack, I/O, and Machine Control Instructions.
PUSH Push Two Bytes of Data onto the Stack
POP Pop Two Bytes of Data off the Stack
XTHL Exchange Top of Stack with Hand L
SPHL Move contents of Hand L to Stack Pointer
The I/O instructions are as follows:IN Initiate Input OperationOUT Initiate Output Operation
![Page 38: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/38.jpg)
Stack, I/O, and Machine Control Instructions.
The machine control instructions are as follows:
EI Enable Interrupt SystemDI Disable Interrupt SystemHLT HaltNOP No Operation
![Page 39: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/39.jpg)
Stack, I/O, and Machine Control Instructions.
RIM
![Page 40: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/40.jpg)
Stack, I/O, and Machine Control Instructions.
SIM
![Page 41: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/41.jpg)
ASSEMBLY LANGUAGE PROGRAMMING
DEEPAK.P41
4/8/14
![Page 42: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/42.jpg)
Programming1. Write an assembly program to add two
numbers
o MVI D, 02BHo MVI C, 06FHo MOV A, Co ADD Do STA 4500o HLT
![Page 43: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/43.jpg)
Program1. Write an assembly program to add two
numbers
o LXI H, 4500o MOV A, Mo INX Ho ADD Mo STA 4500o HLT
![Page 44: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/44.jpg)
Program2. Write an Assembly Language Program to
add two numbers ; results contain carry
LXI H, 4500
MOV A, M
INX H
ADD M
JNC LOOP 1
INR C
LOOP1 STA 4500
MOV A, C
STA 4501
HLT
![Page 45: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/45.jpg)
Program2. Write an Assembly Language Program to
add two numbers ; results contain carry ( write the program using JC)
LXI H, 4500
MOV A, M
INX H
ADD M
JC LOOP 1
JMP LOOP 2
LOOP1 INR C
STA 4500
LOOP1 MOV A, C
STA 4501
HLT
![Page 46: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/46.jpg)
ADDITION OF TWO 16 – BIT NUMBERS
3. To write an assembly language program for adding two 16 bit numbers using 8085 micro processor.
![Page 47: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/47.jpg)
SUM OF DATAS
4. To write an assembly language program to calculate the sum of datas using 8085 microprocessor
![Page 48: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/48.jpg)
SUBTRACTION OF TWO 8 BIT NUMBERS
5. To write a assembly language program for subtracting 2 bit (8) numbers by using- 8085
![Page 49: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/49.jpg)
SUBTRACTION OF TWO 16 BIT NUMBERS
6. To write an assembly language program for subtracting two 16 bit numbers using 8085 microprocessor kit.
![Page 50: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/50.jpg)
Multiplication ; No carryLDA 2000 // Load multiplicant to accumulatorMOV B,A // Move multiplicant from A(acc) to B
registerLDA 2001 // Load multiplier to accumulatorMOV C,A // Move multiplier from A to CMVI A,00 // Load immediate value 00 to aL: ADD B // Add B(multiplier) with ADCR C // Decrement C, it act as a counterJNZ L // Jump to L if C reaches 0STA 2010 // Store result in to memoryHLT // End
![Page 51: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/51.jpg)
Multiplication ; With carry7. Write an assembly program to
multiply a number by 8MVI C,OO
LXI H, 4100
MOV B, M
INX H
MOV A, M
DCR B
LOOP 2 ADD M
JNC LOOP1
INR C
LOOP 1 DCR B
JNZ LOOP2
STA 4500
HLT
![Page 52: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/52.jpg)
Multiplication
![Page 53: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/53.jpg)
DIVISION OF TWO 8 – BIT NUMBERS
To write an assembly language program for dividing two 8 bit numbers using microprocessor
![Page 54: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/54.jpg)
ASCENDING ORDER9. To write a program to sort given ‘n’
numbers in ascending order
![Page 55: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/55.jpg)
DESCENDING ORDER10. To write a program to sort given ‘n’
numbers in descending order
![Page 56: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/56.jpg)
Program11. Write an Assembly Language Program to
transfer a block of data from a series of locations to other.
• MVI C, 0AH ; Initialize counter i.e no. of bytes Store the count in Register C,
ie tenLXI H, 2200H ; Initialize source memory pointer
Data Starts from 2200 locationLXI D, 2300H ; Initialize destination memory pointer
BK: MOV A, M ; Get byte from source memory block i.e 2200 to accumulator.
STAX D ; Store byte in the destination memory block i.e 2300 as stored in D-E pair
![Page 57: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/57.jpg)
ProgramINX H ; Increment source memory
pointerINX D ; Increment destination memory
pointer DCR C ; Decrement counter to keep
track of bytes movedJNZ BK ; If counter 0 repeat steps
HLT ; Terminate program
![Page 58: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/58.jpg)
Largest NumberWrite an Assembly Language Program
to find a largest number.LXI H, 4500
MOV A, M
INX H
CMP M
JNC LOOP 1
JMP LOOP 2
LOOP1 STA 4500
LOOP2 MOV A, M
STA 4500
HLT
![Page 59: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/59.jpg)
Smallest NumberWrite an Assembly Language Program
to find a smallest number.LXI H, 4500
MOV A, M
INX H
CMP M
JC LOOP 1
JMP LOOP 2
LOOP1 STA 4500
LOOP2 MOV A, M
STA 4500
HLT
![Page 60: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/60.jpg)
Occurrence CountingWrite an Assembly Language Program
to count the repetition of a number.
![Page 61: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/61.jpg)
UP CountingWrite an Assembly Language Program
to count up to 7F
![Page 62: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/62.jpg)
UP CountingWrite an Assembly Language Program
to count from &F to 00 , downwards
![Page 63: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/63.jpg)
STACK AND SUBROUTINE
DEEPAK.P63
9/8/14
![Page 64: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/64.jpg)
STACKThe stack is an area of memory identified
by the programmer for temporary storage of information.
The stack is a LIFO structure.
The stack normally grows backwards into memory.
Programmer can defines the bottom of (SP) the stack and the stack grows up into reducing address range.
![Page 65: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/65.jpg)
STACKStack is defined by setting the SP (Stack
Pointer) register.LXI SP, FFFFH ,This sets SP to location
FFFFH (end of memory for 8085).
![Page 66: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/66.jpg)
STACKSave information by PUSHing onto STACK Retrieved from STACK by POPing it off.PUSH and POP work with register pairs only.
Example “PUSH B”– Decrement SP, Copy B to (SP-1)– Decrement SP, Copy C to (SP-1)
Example “POP B”– Copy (SP+1) to C, Increment SP– Copy (SP+1) to B, Increment SP
![Page 67: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/67.jpg)
SUBROUTINEA subroutine is a group of instructions
that is used repeatedly in different places of the program.
It can be grouped into a subroutine and call from the different locations.
The CALL instruction is used to redirect program execution to the subroutine.
The RET instruction is used to return the execution to the calling routine.
![Page 68: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/68.jpg)
SUBROUTINEYou must set the SP correctly before using
CALLCALL 5000H– Push the PC value onto the stack– Load PC with 16‐bit address supplied CALL
ins.RET : Load PC with stack top; POP PC
![Page 69: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/69.jpg)
SUBROUTINE
![Page 70: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/70.jpg)
SUBROUTINESUBRTN:
PUSH PSWPUSH BPUSH DPUSH H
subroutine codingPOP HPOP DPOP BPOP PSWRETURN
![Page 71: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/71.jpg)
SERIAL INPUT / OUTPUT OPERATION
DEEPAK.P71
9/8/14
![Page 72: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/72.jpg)
Serial Input /Out put8085 Microprocessor has two Serial
Input/output pins that are used to read/write one bit data to and from peripheral devices.
SID (Serial Input Data line)There is an One bit Input line inside the 8085
CPU (SID line ,Pin number 5)-The data that is read is stored in the A7th
bit of the Accumulator-RIM instruction is used to read the SID line
![Page 73: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/73.jpg)
Serial Input
![Page 74: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/74.jpg)
Serial InputExample Pseudocode:1) RIM2) A7 (SID)As seen from the figure 1, if the SID line is
connected with +5V and RIM instruction is executed, then the Accumulator’s MSB bit will be loaded with a Logic 1
![Page 75: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/75.jpg)
Serial Input
![Page 76: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/76.jpg)
Serial InputRIM
![Page 77: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/77.jpg)
SOD (Serial Output Data) Line
-There is a One bit Output port inside the 8085 CPU (Pin number 4
-1 bit data can be externally written in this port.
-To write data into this port, SIM instruction is used.
-The data that is to be written in this port must be stored in the A7th bit of the Accumulator.
Bit A6 of the Accumulator is known as SOE (Serial output Enable).
This bit Must be set to 1 to enable Serial data output.
![Page 78: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/78.jpg)
SOD (Serial Output Data) Line
![Page 79: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/79.jpg)
SOD (Serial Output Data) Line
![Page 80: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/80.jpg)
SOD (Serial Output Data) Line
Pseudocode:A 40HSIMSOD (A7)
![Page 81: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/81.jpg)
SOD (Serial Output Data) Line
S
SIM
![Page 82: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/82.jpg)
ProblemThe SID Pin of an 8085 microprocessor is
connected with a 0V/+5V source and the SOD Pin is connected with a LED. Write down the Pseudocode that will read the SID pin of the microprocessor and glow the LED if the SID pin is connected with a +5V source otherwise Turn the Led off if the SID Pin is connected with GND (0V)
![Page 83: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/83.jpg)
INSTRUCTION SUMMARY
![Page 84: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/84.jpg)
INSTRUCTION SUMMARY
![Page 85: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/85.jpg)
INSTRUCTION SUMMARY
![Page 86: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/86.jpg)
INSTRUCTION SUMMARY
![Page 87: DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1](https://reader036.vdocuments.site/reader036/viewer/2022062313/56649d6e5503460f94a4fdfd/html5/thumbnails/87.jpg)
INSTRUCTION SUMMARY