how to calculate delay time in 8051

Status
Not open for further replies.

mishra12

Advanced Member level 2
Joined
Feb 18, 2009
Messages
672
Helped
136
Reputation
272
Reaction score
122
Trophy points
1,323
Location
some where left alone
Visit site
Activity points
4,915
pls help me on this topic



delay2:
mov r5,#180
cont5: mov r2,#255
cont4: mov r1,#255
cont3: djnz r1, cont3
djnz r2, cont4
djnz r5, cont5
ret
end
how 180 comes is there any formula to calculate ? pls help soon
thanks
 

in 8051 assembly programming each instruction takes some machines cycle to execute. machine cycle depend on your controller and crystal value.

e.g 8051 with 11.0952MHz crystal ,machine cycle=1.085us

MOV take 1 machine cycle time delay=1*1.085us
DJNZ takes 2 machine cycles time delay=2*1.085us

adding all the instruction's time sepatrately and add.

you can see this book "8051 and embedded system" by Ali Mazidi for more detail
 

    mishra12

    Points: 2
    Helpful Answer Positive Rating
Here you can find a method to calculate the delay time



hope your comments

regards
bassa
 

    mishra12

    Points: 2
    Helpful Answer Positive Rating
Just download the time8051 program here:
**broken link removed**

you just enter your clock speed, and the amount of microseconds, and you have the source code in assembly. It's really easy.

look at my post here:


Good Luck
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…