Rules | Recent posts | topic RSS | Search | Register  | Log in

1sec delay program for 89c51

 
Post new topic  Reply to topic    EDAboard.com Forum Index -> Embedded Systems and Real-Time OS
Author Message
srinivasan2323



Joined: 05 Feb 2008
Posts: 25


Post19 Mar 2008 6:57   1sec delay program for 89c51

hi i need a 1sec delay program for my 89c51 program
Back to top
IanP



Joined: 05 Oct 2004
Posts: 6347
Helped: 1505
Location: West Coast


Post19 Mar 2008 7:41   Re: 1sec delay program for 89c51

http://www.edaboard.com/viewtopic.php?t=284188

rgds,
IanP
Back to top
user1111



Joined: 24 Mar 2007
Posts: 25


Post26 Mar 2008 13:16   Re: 1sec delay program for 89c51

Ist make delay of 50ms using 16 bit timer
then call it 20 times
Back to top
kcho



Joined: 12 Feb 2003
Posts: 29


Post25 Apr 2008 15:21   Re: 1sec delay program for 89c51

how
Back to top
ckshivaram



Joined: 21 Apr 2008
Posts: 327
Helped: 22
Location: india


Post13 May 2008 9:12   answer for your question

Hi;

when u load 00 in 16 bit timer it takes 71.1msec to reach FF and overflow.
so 71.1msec *14times loop gives appx 995msec. for looping back in your program after overflow all corresponds to 1sec delay. So write a program with 00 in timer and repeat it for 14 times.
measure it you will get 1 sec delay.

write in assembly only not in C.
Back to top
user1111



Joined: 24 Mar 2007
Posts: 25


Post20 May 2008 13:47   Re: 1sec delay program for 89c51

void delay1s(void){
unsigned char count = 50;
while(count>0){
TH0=183;
TL0=255;
TMOD=1;
TR0=1;
while(!TF0){
}
TF0=0;
TR0=0;
count--;
}

}
Back to top
chandanghonmode10



Joined: 29 May 2008
Posts: 5


Post29 May 2008 13:14   Re: 1sec delay program for 89c51

srinivasan2323 wrote:
hi i need a 1sec delay program for my 89c51 program


Best way u use Timer insted of for loop for exact timing.
First u can load the value in 16 - bit timer for 50 ms. so loading the timer for 20 times,u will get exact 1 sec delay.
Back to top
aderich



Joined: 03 Jun 2008
Posts: 8


Post05 Jun 2008 20:48   Re: 1sec delay program for 89c51

hi,
you can decide to use timers or a routine call
for instance,
mov r0,#4
mov r1,#250
mov r2,#250
lop:
nop
nop
djnz r1,$
djnz r2,$
djnz r0,lop
end
such program would give a isecond delay but alternatively one may decide to use the timers of the 89c51
Back to top
jiraju



Joined: 06 Jun 2008
Posts: 11


Post06 Jun 2008 9:45   1sec delay program for 89c51

first tell me the crystal value which u r using for system
Back to top
Post new topic  Reply to topic    EDAboard.com Forum Index -> Embedded Systems and Real-Time OS
Page 1 of 1 All times are GMT + 1 Hour


Abuse
Administrator
Moderators
topic RSS 
sitemap