August 29, 2011
Division of two number using Microcontroller
Aim: Write a program to division of 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 08H and 02H respectively. Write a program to divide these values.
Algorithm:
Algorithm:
- Load data into Register R0 and R1.
- Move one data into Accumulator.
- Move other data into in Register B.
- Divide A from 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.
DIV AB: This instruction divides a byte accumulator by the byte in Register B. 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.
Result:
Input: R0=08 H, R1=02 H
Output: A=04 H and it will store at external memory 4012.
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