Running 2 Youtube Channel : The Masti Adda (Fun based ) : The Knowledge Adda (Knowledge based) : Subscribe for Knowledge with Fun....
Written by @
Aim: Write an ALP to move block of data bytes present in external memory with Starting address 4000H to the destination memory with starting address 4100H and size of array of data is 10H. 
Apparatus Used: Micro-controller kit.
Assumption: Ten numbers stored in memory locations starting from 4000H must be moved to 4100H onwards.
Algorithm:
1. Set byte counter.
2. Initialize the DPTR to store higher Byte and Lower Byte of a given Location as source.
3. Store the source number into the accumulator.
4. Initialize the DPTR to store the higher byte of a given location as destination.
5. Copy the number stored in accumulator to destination location.
6. Increment the DPTR to get next number.
7. Decrement counter and repeat the above step until the byte counter is reset.
Program:
 
Description of used instruction:
MOV: Used for Load and Copy the Data. This copies a byte from the source location to destination.
DJNZ: In this instruction a byte is decremented, and if result is not zero it will jump to the target address.
MOVX: This instruction transfer data between external memory and register A.
DPTR: This is Data Pointer. It is used for containing 16 bit data or memory address.
SJMP: Short Jump loop is used for indefinite loop within program basically used to end the program.
INC: This instruction adds 1 to the register or memory location specified by the operand.
82/83: These are Special Function Register address. These are used to store the address of DPL and DPH of a given DPTR respectively.

Result:

Input:    4000-01
            4001-02
            4002-03
            4003-04
            4004-05
Output: 4100-01
            4101-02
            4102-03
            4103-04
            4104-05
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 Location of Input as in this program 4000H. Press Space and write a first number and Press Space and provide second number and so on..
·         Press Enter two times again.
·         Press G and provide starting address and Press Enter.
·         You will Get Message “Execution Completed”.
·         Press M and You will Get Message “Enter Address”.
·         Provide Address for Output as in this Program 4100H and Press Space and you get Output and so on.

 
 

No comments:

Post a Comment