August 29, 2011
Multiplication of two number using Micro-controller
Aim: Write a program to multiply 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 03H and 02H respectively. Write a program to multiply these values.
Algorithm:
Algorithm:
- Load data into Register R0 and R1.
- Move one data in Accumulator.
- Move other data in Register B.
- Now multiply A into B.
- Initialize memory location to store output.
- Store output at given location.
Program:
Description of used instruction:
Register B: Generally used for multiplication and division.
MOV: Used for Load and Copy the Data. This copies a byte from the source location to destination.
MUL AB: This instruct multiply a byte of accumulator to byte of register B..
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.
Result:
Input: R0=03 H, R1=02 H
Output: A=06 H and it will store at external memory 4012.
Procedure to look output:
. After ending (SJMP) the program, press Enter two times.
Procedure to look 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 4012 H and Press Space and you get Output.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment