Sie sind auf Seite 1von 22

ASSEMBLY LANGUAGE PROGRAM

WITH MICRO PROCESSOR


Introduction

• Microprocessor is a integrated circuit that can capable of executing an action or set of


actions based upon the instruction of a computer software or a program

• In this presentation we mainly focused about Intel 8085 microprocessor

• Intel 8085 microprocessor has following characteristics,

o Operated from 5v power supply


o Operated at 3.2MHz clock speed
o 8-bit data bus
o 16-bit address bus
o 16 bit program counter and stack pointer
o 6-8bit general purpose registers
8085 pin diagram
Architecture of 8085 microprocessor
Registers
Accumulator

• The accumulator is an 8-bit register that is a part of arithmetic/logic


unit (ALU).
• This register is used to store 8-bit data and to perform arithmetic and
logical operations.
• The result of an operation is stored in the accumulator.

General purpose register

• There are 6 general purpose registers in 8085 processor.


• Each register can hold 8-bit data.
• These registers can work in pair to hold 16-bit data and their pairing
combination is like B-C, D-E & H-L.

Program Counter

• The program counter is a 16 bit register. It acts as a pointer which


indicates the address of the next instruction to be executed.
Stack Pointer

• It is a 16-bit register works like stack, which is always incremented/decremented by 2 during


push & pop operations.

Temporary register

• It is an 8-bit register, which holds the temporary data of arithmetic and logical operations.

Flag (F) Register

• It is an 8-bit register associated with the execution of instructions in the microprocessor.


• Out of the 8 bits of flag register, 5 bits contains significant information in terms of status flags.

Sign flag (S)-Sign flag is set, if the result of the operation of the instruction is negative, otherwise
it is reset for the positive result

Zero flag (Z)-The zero flag is set if the result of the operation of the instruction is zero otherwise
this flag is reset.
Carry flag (CY)-The carry flag is set to 1, if there exist a carry (or borrow) to the
highest order bit If there is no carry (or borrow) to the higher order bit, the carry
flag is reset.

Parity flag (P) -If the result has even number of 1s, then parity bit is set. If the result
has odd number of 1s, the parity flag is reset.

Auxiliary carry (AC) -Auxiliary carry flag is set to 1, if there is an overflow


Instruction set of Intel 8085

Group Description Examples

Data Transfer Group used to transfer data from one register to another MOV,MVI,LXI,LDA,STA
register, from memory to register or register to
memory
Arithmetic Group perform arithmetic operations such as addition, ADD,SUB,INR,DCR
subtraction; increment or decrement of the
content of a register or memory.

Logical Group perform logical operation such as AND, OR, ANA,XRA,ORA,CMP


compare, rotate etc.

Branch Control Group includes the instructions for conditional and JMP,JC,JZ,CALL
unconditional jump, subroutine call and return,
and restart.
I/O and Machine Control includes the instructions for input/output ports, IN,OUT,PUSH,POP,HLT
Group stack and machine control.
Addition of two 8 bit numbers

Code Description
MVI C,00 Initialize the register ‘C’ as ‘Zero’
LDA 4000 Load the 8 bit data in memory location 4000H to the
accumulator

MOV B,A Transfer the contents of accumulator into the register ‘B’

LDA 4001 Load the 8 bit data in memory location 4001H to the
accumulator

ADD B Add the 2 - 8 bit data and check for carry.


JNC SKIP Jump on if no carry
INR C If there is carry increment register c by 1
SKIP: STA 4002 Store the result in accumulator to memory location 4002H

MOV A,C Move the content of register ‘C’ to accumulator


STA 4003 Store the register ‘C’ in accumulator to memory location 4003H

HLT Stop the program execution.


Program screenshot of Addition of two 8 bit numbers
Subtraction of two 8 bit numbers
Code Description
MVI C,00 Initialize the register ‘C’ as ‘Zero’
LDA 4000 Load the 8 bit data in memory location 4000H to the accumulator

MOV B,A Move the contents of accumulator into the register ‘B’
LDA 4001 Load the 8 bit data in memory location 4001H to the accumulator

SUB B Subtract the 2 - 8 bit data and check for borrow


JNC SKIP Jump on if no barrow
CMA Complement accumulator content
INR C If there is barrow increment register c
INR A If there is barrow increment accumulator
SKIP: STA 4002 Store the result in accumulator to memory location 4002H

MOV A,C Move the register ‘C’ value to accumulator


STA 4003 Store the register ‘C’ in accumulator to memory location 4003H

HLT Stop the program execution.


Program screenshot of subtraction of two 8 bit numbers
Multiplication of two 8 bit numbers
Code Description
MVI C,00 Initialize the register ‘C’ as ‘Zero’
LDA 4000 Load the 8 bit data in memory location 4000H to the accumulator
MOV B,A Move the contents of accumulator into the register ‘B’

LDA 4001 Load the 8 bit data in memory location 4001H to the accumulator
MOV D,A Move the contents of accumulator into the register ‘D’

MVI A,00 Initialize the accumulator as ‘Zero’


LOOP: ADD D Add value of register ’D’ to accumulator
JNC SKIP Jump on if no carry
INR C If there is carry increment by 1
SKIP: DCR B Decrement the value of register ‘B’

JNz LOOP Jump on loop until value of the register ‘B’ becomes zero

STA 4002 Store the result in accumulator to memory location 4002H


MOV A,C Move the register ‘C’ value to accumulator
STA 4003 Store the register ‘C’ value in accumulator to memory location 4003H
HLT Stop the program execution.
Program screenshot of multiplication of two 8 bit numbers
Division of two 8 bit numbers
Code Description
MVI C,00 Initialize the register ‘C’ as ‘Zero’
LDA 4000 Load the 8 bit data in memory location 4000H to the accumulator

MOV B,A Copy the contents of accumulator into the register ‘B’
LDA 4001 Load the 8 bit data in memory location 4001H to the accumulator

NEXT: CMP B Compare value in accumulator with the value in register ‘B’
JC LOOP Jump if divider is greater than dividend
SUB B Subtract the dividend value by divider value
INR C increment the register “c” by 1
JMP NEXT Jump to step 6, till the dividend becomes zero
LOOP: STA 4002 Store the result in accumulator to memory location 4002H

MOV A,C Move the value of register ‘C’ to accumulator


STA 4003 Store the register ‘C’ value in accumulator to memory location
4003H

HLT Stop the program execution.


Program screenshot of division of two 8 bit numbers
Addition of two 16 bit numbers
Code Description
MVI C,00 Initialize the register ‘C’ as ‘Zero’
LDA 4000 Load the 8 bit data in memory location 4000H to the accumulator
MOV B,A move the contents of accumulator into the register ‘B’
LDA 4001 Load the 8 bit data in memory location 4001H to the accumulator
ADD B Add the 2 - 8 bit data
STA 4005 Store the result in accumulator to memory location 4005H
LDA 4002 Load the 8 bit data in memory location 4002H to the accumulator
MOV B,A Copy the contents of accumulator into the register ‘B’
LDA 4003 Load the 8 bit data in memory location 4003H to the accumulator
ADC B add the content of register ‘B’ and previous carry from lower bit addition

STA 4006 Store the result in accumulator to memory location 4006H


MOV A,C Move the value of register ‘C’ to accumulator
STA 4007 Store the result in accumulator to memory location 4007H
hlt Stop the program execution
Program screenshot of Addition of two 16 bit numbers
Need of microprocessor in electrical engineering field

• Now a days microprocessors are being used for Monitoring, controlling and many
other sort of purposes in following systems in electrical engineering field

1. Universal Data Acquisition and Control System

• Voltage Control
• Automatic Switching Sequence
• Automatic reclosing
• generator sequence control
• generator efficiency monitoring
• revenue metering collection
• alarm logging
• fault level monitoring.

2. Integrated Substation Control System

• To provides full control over data-base updating


• output execution
• automatic execution of selected sequence.
3.Integrated Control and Protection Systems

• control and protective relaying functions

4.SCADA System (Supervisory Control And Data Acquisition )

• To utilities such as power, Oil & Gas, water and waste management

5.Unconventional Monitoring Systems

To monitoring power transformer parameters such as,

• saturation curves
• over excitation
• gas content
• partial discharges
• insulation damages.
Types of embedded systems used in engineering field
Embedded systems Description Example
general purpose designer only needs to program the 8085,8086, AMD64, Intel 64
processor processor’s memory to carry out the
required functionality
single purpose processor designed to execute exactly one program 7400 series,4000 series.

application specific designed for a particular class of Texas Instruments C6000 series,
instruction-set applications with common Freescale MSC81xx, XMOS
processor (ASIP) characteristics
Programmable Logic inputs from switches and sensors, SIMENS, Allen-Bradley, ABB
Controller (PLC) evaluating these based on a program MITSUBISHI,HITACHI
(logic) and changing the state of outputs
to control a machine or process
Microcontroller Microcontroller is like a mini computer Atmega8, 16, 32, Arduino
with a CPU along with RAM, ROM, serial Community, PIC
ports, timers, and IO peripherals all
embedded on a single chip
Thank you

Das könnte Ihnen auch gefallen