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.

[SOLVED] Problem with code for 1 sec delay in Keil compiler

Status
Not open for further replies.

rohini.embsystem

Newbie level 4
Joined
May 19, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
pune
Activity points
1,328
hi
i need 1 sec delay
i hv written the code like
void delay()
{
for(i=0;i<1275;i++)
for(j=0;j<20;j++);
}
it is giving me 1/2 sec delay.bt how to calculate it? m using keil compiler n controller is ATMEL 89C51. can anybody help me?
 

Re: delay for 1 sec

basically time delay is based on code optimization in Keil compiler (how it optimize the loops)

If you need accurate delay, it is better to use timers

read this application notes https://www.keil.com/appnotes/files/apnt_105.pdf
 
Re: delay for 1 sec

Hi,

What Crystal Frequency you are using?

Regards,
Viswanath
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top