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.

1sec delay program for 89c51

Status
Not open for further replies.

srinivasan2323

Junior Member level 2
Joined
Feb 5, 2008
Messages
23
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,377
89c51 1ms delay

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

1 sec delay using timer in 89c51



rgds,
IanP
 

    V

    Points: 2
    Helpful Answer Positive Rating
delay using timer of 89c51

Ist make delay of 50ms using 16 bit timer
then call it 20 times
 

    V

    Points: 2
    Helpful Answer Positive Rating
how to find loop delay c in 89c51

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.
 

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--;
}

}
 

srinivasan2323 said:
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.
 

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
 
first tell me the crystal value which u r using for system
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top