Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Delay time calculation for 8051 using three nested loops

Status
Not open for further replies.

ark5230

Advanced Member level 3
Joined
Jun 29, 2009
Messages
862
Helped
163
Reputation
324
Reaction score
140
Trophy points
1,323
Location
India
Activity points
6,187
I am trying to get delay of one second using nested loops in 8051 assembly, use of timer will simplify this but it is required to do it this way!
Is this calculation OK ?
In implementation it is taking around 10 seconds instead of one second.
WAIT: MOV R2,#46
HERE1: MOV R3,#100
HERE2: MOV R4,#100
HERE3: DJNZ R4,HERE3
DJNZ R3,HERE2
DJNZ R2,HERE1
RET
Calculated time Micro sec 1030901
Sec 1.0309
Delay loop.png
Exec is number of time it is executed
M/C is the machine cycles used
Tot M/C is total machine cycles required
Clock is 11.0592 MHz (M/C is 1.085µs)
 
Last edited:

Use this...

ONE: MOV R3,#8
MOV R2,#8
MOV R1,#236

TWO: DJNZ R1,TWO
DJNZ R2,TWO
DJNZ R3, TWO



HOPE IT WORKS...
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top