Delay in 8051 Keil in C

Status
Not open for further replies.

pradeep221899

Newbie level 1
Joined
Sep 7, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,285
I want to generate delay of 5 minutes in 8051 in C .i'm using KEIL software..
How can i do it?

waiting for your reply.....

Thanks..
 

There are many ways to do this

Ex: create 60ms delay using timers and loop until 5000

If your crystal = 12 MHz then check this sample code


Code C++ - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
delay_5m() 
{
int d;
for(d=0;d<=5000;d++)
{
TMOD=0x01;
TL0=0xA0;
TH0=0x15;
TR0=1; 
while(TF0==0); // run until TF turns to 1
TR0=0; 
TF0=0; 
}
}

 
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…