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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top