Running 2 Youtube Channel : The Masti Adda (Fun based ) : The Knowledge Adda (Knowledge based) : Subscribe for Knowledge with Fun....

Subtraction of two number using micro-controller

Written by @
Aim: Write a program to subtract two 8-bit numbers stored in Register R0 and R1 and store the result at 4012 memory location using micro-controller kit.
Apparatus Used:  Micro-controller kit.

Assumption: Suppose the content of register R0 and R1 are 12 and 11 respectively. Write a program to subtract these values.
  • Load Data into Register R0 and R1
  • Move one data into accumulator.
  • Subtract other data from accumulator.
  • Initialize memory point to store output
  • Store output at given location.

Description of used instruction:
MOV: Used for Load and Copy the Data. This copies a byte from the source location to destination.
SUB: This subtracts the source byte from the accumulator and keeps result in accumulator.
MOVX: This instruction transfer data between external memory and register.
DPTR: This is Data Pointer. It is used for containing 16 bit data or memory address.
SJMP: Short Jump loop is used for loop within program.

Input:   R0=12, R1=11
Output: A=12-11=01 and it will store at external memory 4012H.

Procedure to find output:
·         After ending (SJMP) the program, press Enter two times.
·         You will get message “Welcome to ------KIT”.
·         Press G and Provide initial address of program as in this program, starting address is 3000 H.
·         Press Enter.
·         After pressing Enter, You will get Message “Execution Completed”.
·         Press Reset on micro-controller KIT.
·         Press M and You will get Message “Enter Address”.   
·         Provide Address for Output as in this Program 4012H and Press Space and you get Output.
  • Download....Exp-2                                                                                           

    No comments:

    Post a Comment