Generating a 10ms Delay in Assembly Programming

29 Apr 2023 Balmiki Mandal 0 Assembly language

Generate 10 milli-seconds Delay using Assembly Language

In this article, we will understand the process to generate a 10 milli-seconds delay in assembly language. This delay can be used for time measurement and to create pauses between operations or prints.
Steps for Generating 10 miliseconds Delay
1) Start the program by loading the value 10 in the accumulator.

2) Now use the MOV instruction to move the accumulator’s value to B register.

3) Use the following loop to generate the delay of 10 milliseconds. loop: MVI A,05H // Load the value 5 in accumulator SUB B // Decrement B by 1 JNZ loop // Jump to loop if result is not 0

4) Once the loop terminates, the delay of 10 milliseconds is generated.

 

Program

CSEG AT 0X100
delay 1ms:
          MOV R0,#250
L1: DJNZ R0,L1
           MOV R0,#247
L2: DJNZ R0,L2
            RET
CSEG AT 0x0
ACALL delay 1ms;
L3: SJMP L3:delay
END
        


Conclusion
In this article, we have seen how to generate a delay of 10 milliseconds using assembly language programming. This technique can be used for time measurement and creating pauses between operations.

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.