DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1.

Slides:



Advertisements
Similar presentations
PROGRAMMING WITH 8085 BTCS-404 (MALP) B.Tech 4th SEM. IT
Advertisements

Dept. of Electronics A. N. College, Patna M. Sc
8085 Architecture & Its Assembly language programming
Parul Polytechnic Institute Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name.
8085 Architecture & Its Assembly language programming
Processor System Architecture
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
TK 2633 Microprocessor & Interfacing
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Room: Timbalan Pengarah Pusat Komputer Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 4: Introduction.
TK 2633 Microprocessor & Interfacing
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
8051 ASSEMBLY LANGUAGE PROGRAMMING
8085 Addressing Modes.  The number & Different kind of ways the programmer can refer to data stored in the memory  The different ways that a microprocessor.
Parul Polytechnic Institute Parul Polytechnic Institute Subject Code : Name Of Subject : Microprocessor and assembly language programming Name.
INSTRUCTION SET OF MICROPROCESSOR 8085
UNDERSTANDING ASSEMBLY LANGUAGE.
DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1.
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 7.
Microprocessor. Interrupts The processor has 5 interrupts. CALL instruction (3 byte instruction). The processor calls the subroutine, address of which.
Ass. Prof. Dr Masri Ayob Lecture 5: Arithmetic and Logic Instructions TK 2633: Microprocessor & Interfacing.
ASSEMBLY LANGUAGE.  Upon completing this topic, you should be able to: Classify the 8085A microprocessor instructions Explain the basic function of common.
Computer Architecture Lecture 11 by Engineer A. Lecturer Aymen Hasan AlAwady 10/3/2014 University of Kufa - Information Technology Research and Development.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 8.
Assembly Language Programming of 8085 BY Prof. U. V. THETE Dept. of Computer Science YMA.
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
Ass. Prof. Dr Masri Ayob TK 2123 Lecture 14: Instruction Set Architecture Level (Level 2)
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
8085 Microprocessor: Architecture & Support Components.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Internal Programming Architecture or Model
8 085Microprocessor Temp Reg (8) Accumulator (A reg) Flag flip flops(8) Instruction Register (8) Arithmetic Logic Unit ALU Instruction Decoder and Machine.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني 8085 Instruction Set logic group. Branch group. Stack memory and machine control. Addressing modes.
AMITY UNIVERSITY RAJASTHAN Present By M.Sc Applied Chemistry.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني 8085 Instruction Set Instruction types. data transfer group. Arithmetic group.
The 8085A is a general-purpose microprocessor with low hardware overhead requirements. Within the 8085A are contained the functions of clock generation,
Introduction to 8085 Microprocessor
8085 Microprocessor Architecture
Seminar On 8085 microprocessor
Gursharan Singh Tatla INSTRUCTION SET OF 8085 Gursharan Singh Tatla Gursharan Singh Tatla
Unit 1 Instruction set M.Brindha AP/EIE
PROGRAMMING OF 8085 PROCESSOR
Instruction format Instruction is a command to microprocessor to perform a given task on specified data. Each instruction has two parts: One is the task.
Gunjeet Kaur Dronacharya Group of institutions
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
Detailed Review of the 8085 Instruction Set.
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
Introduction to 8085 Instructions
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 3 & 4 Part 2
Presented by: Chi Yan Hung
TAO1221 COMPUTER ARCHITECTURE AND ORGANIZATION LAB 3 & 4 Part 1
8085 microprocessor.
The 8085 Microprocessor Architecture
Additional data transfer and 16 bit arithmetic instruction Lecture 1
EMT 245: lecture 4: assembly language
MICROPROCESSOR AND PERIPHERAL DEVICES
Number Representations and Basic Processor Architecture
R.RAJKUMAR DEPARTMENT OF CSE
Detailed Review of the 8085 Instruction Set.
Prepared by Kenan BOZDAŞ
Architecture & Support Components
Chapter 1 Introduction.
INSTRUCTION SET OF 8085.
EE6502/MPMC/UNIT II/STACK AND SUBROUTINE/T.THARANKUMAR
Programming Examples.
Computer Operation 6/22/2019.
Branching Instructions By Dr. S. N. Sampat, Team leader Ms. R. P
Presentation transcript:

DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1

DEEPAK.P UNIT 2 2

8085 PROGRAMMING MODEL DEEPAK.P 3 1/8/14

Overview: 8085 Programming model 1. Six general-purpose Registers 2. Accumulator Register 3. Flag Register 4. Program Counter Register 5. Stack Pointer Register

Programming Model 5 DEEPAK.P

Programming Model 6 DEEPAK.P

Instruction & Data Formats DEEPAK.P 7 1/8/14

Instruction & Data Formats 8085 Instruction set can be classified according to size (in bytes) as 1. 1-byte Instructions 2. 2-byte Instructions 3. 3-byte Instructions 1. Includes Opcode and Operand in the same byte 2. First byte specifies Operation Code Second byte specifies Operand 3. First byte specifies Operation Code Second & Third byte specifies Operand

Instruction & Data Formats 1. 1-byte Instructions Eg. MOV A, M, CMA, DAA etc 2. 2-byte Instructions Eg. MVI A, 08, IN 02, CPI 03 etc 3. 3-byte Instructions Eg. LXI H, 4500, STA 4600, LDA 4200

ADDRESSING MODES DEEPAK.P 10 1/8/14

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

Addressing Modes of ) Immediate Addressing Mode: In this type of addressing mode, immediate data byte is provided with the instruction. Example: MVI A 47H, LXIH, 4100H etc.

Memory Addressing One of the operands is a memory location Depending on how address of memory location is specified, memory addressing is of two types Direct addressing Indirect 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

Addressing Modes of ) 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 30H A 20H H 50H L 30H 2050H

Addressing Modes of ) 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

INSTRUCTION SET DEEPAK.P 16 1/8/14

Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV, MVI 246 Instructions, e.g. MOV A,B, MVI A, instructions can be classified as 1. Data Transfer (Copy) 2. Arithmetic 3. Logical and Bit manipulation 4. Branch 5. Machine Control

Data Transfer Instruction MOV Move MVIMove Immediate LDALoad Accumulator Directly from Memory STAStore Accumulator Directly in Memory LHLDLoad Hand L Registers Directly from Memory SHLDStore Hand L Registers Directly in Memory LXILoad register pair Immediate LDAXLoad accumulator indirect STAXStore Accumulator In direct XCHGExchange DE pair and HL pair XTHLExchange between HL pair and stack

Data Transfer Instruction

Data Transfer Instructions IN portaddr i.e. IN 00 ( Reads data from the Input Switch, 0 0represents the port address of the input switch) OUT portaddr i.e. OUT 00 ( Writes data to the Display device where 00 represents the Port address of the display)

Data Transfer Instructions The 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.

Arithmetic Instructions ADDAdd to Accumulator ADI Add Immediate Data to Accumulator ADCAdd to Accumulator Using Carry Flag ACI Add Immediate Data to Accumulator Using Carry Flag SUBSubtract from Accumulator SUISubtract Immediate Data from Accumulator

Arithmetic Instructions SBB Subtract from Accumulator Using Borrow ((:Carry) Flag SBI Subtract I mmediate from Accumulator Using Borrow INR Increment Specified Byte by One DCRDecrement Specified Byte by One INXIncrement Register Pair by One DCXDecrement Register Pair by One DAD Double Register Add: Add Contents of Register Pair to Hand L Register Pair

Arithmetic Instructions

Logical Instructions ANALogical AND with Accumulator ANI Logical AND with Accumulator Using Immediate Data ORALogical OR with Accumulator ORI Logical OR with Accumulator Using Immediate Data XRAExclusive Logical OR with Accumulator XRIExclusive OR Using Immediate Data CMPCompare CPICompare Using Immediate Data

Logical Instructions RLCRotate Accumulator Left RRCRotate Accumulator Right RALRotate Left Through Carry RARRotate Right Through Carry CMAComplement Accumulator CMCComplement Carry Flag STCSet Carry Flag

Logical Instructions

Branching Instructions The unconditional branching instructions are as follows: JMPJump CALLCall RETReturn Conditional branching instructions jumps Calls Returns JC CC RC (Carry) JNC CNC RNC (No Carry) JZ CZ RZ (Zero) JNZ CNZ RNZ (Not Zero)

Branching Instructions JP CP RP (Plus) JM CM RM (Minus) JPE CPE RPE (Parity Even) JPO CPO RPO (Parity Odd) PCHLMove Hand L to Program Counter RSTSpecial Restart Instruction Used with Interrupts

Jump Instructions

Call Instructions

Return Instructions

Re start Instructions

Stack, I/O, and Machine Control Instructions. PUSHPush Two Bytes of Data onto the Stack POPPop Two Bytes of Data off the Stack XTHL Exchange Top of Stack with Hand L SPHLMove contents of Hand L to Stack Pointer The I/O instructions are as follows: INInitiate Input Operation OUTInitiate Output Operation

Stack, I/O, and Machine Control Instructions. The machine control instructions are as follows: EIEnable Interrupt System DIDisable Interrupt System HLTHalt NOPNo Operation

Stack, I/O, and Machine Control Instructions. RIM

Stack, I/O, and Machine Control Instructions. SIM

ASSEMBLY LANGUAGE PROGRAMMING DEEPAK.P 41 4/8/14

Programming 1. Write an assembly program to add two numbers oMVI D, 02BH oMVI C, 06FH oMOV A, C oADD D oSTA 4500 oHLT

Program 1. Write an assembly program to add two numbers oLXI H, 4500 oMOV A, M oINX H oADD M oSTA 4500 oHLT

Program 2. 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

Program 2. 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

ADDITION OF TWO 16 – BIT NUMBERS 3. To write an assembly language program for adding two 16 bit numbers using 8085 micro processor.

SUM OF DATAS 4. To write an assembly language program to calculate the sum of datas using 8085 microprocessor

SUBTRACTION OF TWO 8 BIT NUMBERS 5. To write a assembly language program for subtracting 2 bit (8) numbers by using- 8085

SUBTRACTION OF TWO 16 BIT NUMBERS 6. To write an assembly language program for subtracting two 16 bit numbers using 8085 microprocessor kit.

Multiplication ; No carry LDA 2000 // Load multiplicant to accumulator MOV B,A // Move multiplicant from A(acc) to B register LDA 2001 // Load multiplier to accumulator MOV C,A // Move multiplier from A to C MVI A,00 // Load immediate value 00 to a L: ADD B // Add B(multiplier) with A DCR C // Decrement C, it act as a counter JNZ L // Jump to L if C reaches 0 STA 2010 // Store result in to memory HLT // End

Multiplication ; With carry 7. Write an assembly program to multiply a number by 8 MVI C,OO LXI H, 4100 MOV B, M INX H MOV A, M DCR B LOOP 2ADD M JNC LOOP1 INR C LOOP 1DCR B JNZ LOOP2 STA 4500 HLT

Multiplication

DIVISION OF TWO 8 – BIT NUMBERS To write an assembly language program for dividing two 8 bit numbers using microprocessor

ASCENDING ORDER 9. To write a program to sort given ‘n’ numbers in ascending order

DESCENDING ORDER 10. To write a program to sort given ‘n’ numbers in descending order

Program 11. 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 ten LXI H, 2200H ; Initialize source memory pointer Data Starts from 2200 location LXI 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

Program INX H ; Increment source memory pointer INX D ; Increment destination memory pointer DCR C ; Decrement counter to keep track of bytes moved JNZ BK ; If counter 0 repeat steps HLT; Terminate program

Largest Number Write 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 LOOP2MOV A, M STA 4500 HLT

Smallest Number Write an Assembly Language Program to find a smallest number. LXI H, 4500 MOV A, M INX H CMP M JC LOOP 1 JMPLOOP 2 LOOP1 STA 4500 LOOP2MOV A, M STA 4500 HLT

Occurrence Counting Write an Assembly Language Program to count the repetition of a number.

UP Counting Write an Assembly Language Program to count up to 7F

UP Counting Write an Assembly Language Program to count from &F to 00, downwards

STACK AND SUBROUTINE DEEPAK.P 63 9/8/14

STACK The 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.

STACK Stack is defined by setting the SP (Stack Pointer) register. LXI SP, FFFFH,This sets SP to location FFFFH (end of memory for 8085).

STACK Save 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

SUBROUTINE A 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.

SUBROUTINE You must set the SP correctly before using CALL CALL 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

SUBROUTINE

SUBRTN: PUSH PSW PUSH B PUSH D PUSH H subroutine coding POP H POP D POP B POP PSW RETURN

SERIAL INPUT / OUTPUT OPERATION DEEPAK.P 71 9/8/14

Serial Input /Out put 8085 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

Serial Input

Example Pseudocode: 1) RIM 2) 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

Serial Input

RIM

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.

SOD (Serial Output Data) Line

Pseudocode: A  40H SIM SOD  (A7)

SOD (Serial Output Data) Line S SIM

Problem The 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)

INSTRUCTION SUMMARY