Questions
user482user482asked 4 months ago
I want to add a software delay in my assembly program without using timers in 8051 mcu. How to do calculation on it.
1

1 Answers

Accepted
codegenlabcodegenlabanswered 4 months ago
You may follow the following example and your answer will be there.
Example:
DELAY_LOOP: MOV R1,#pH
LOOP2: MOV R2,#qH ;Inner-loop
LOOP1: DJNZ R2,LOOP1 ;Outer-loop
DJNZ R1,LOOP2
* pand qare integers
Calculation:
Inner loop:
2 x q = 2q machine cycles
Outer loop:
total machine cycles = (2q+2+1)p–1
Total Time Delay= [(2q+2+1)p–1] x 1 Machine Cycle Time
1