Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

How can I make a 1/2 sec delay in 89c51 using Keil C?

Status
Not open for further replies.

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
i have made a program /blinking led/ but i think its too fast, how can i make a 1/2 sec delay using Keil C
My chip is 89c51 on 4Mhz /i dont know how to calculate a speed/

for (i=0; i<????????; i++){
for(j=0; j<?????; j++);
}

Thanks :))
 

buts101

Full Member level 3
Joined
Apr 29, 2005
Messages
168
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Activity points
2,867
how to calculate delay in 89c51 using c

use this little application to generate the exact delay u want..it is in assembly code..u can embedded the assembly code in C.
 

syrax

Full Member level 3
Joined
Sep 15, 2005
Messages
183
Helped
11
Reputation
22
Reaction score
3
Trophy points
1,298
Activity points
2,620
delay in c code in 89c51]

10x it's coll, i try it but have a problem when insert asm i C code
:))
 

Jack// ani

Advanced Member level 3
Joined
Dec 2, 2004
Messages
759
Helped
106
Reputation
220
Reaction score
58
Trophy points
1,308
Activity points
5,018
Delay in 89c51

there is asm directive to do so.....looks something like #asm Look in the manual for details....
 

ezshereef

Junior Member level 3
Joined
Jan 5, 2006
Messages
27
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,281
Activity points
1,524
Re: Delay in 89c51

hi ,

to calculate time, you can never use these "for loops" to adjust accurate timing. you should use one of the timers on board of the 89c51 chip that you use. this is the only way to achieve accurate timing. if you need further help please send me and i'll provide help for using timers.
 

eng_ahmed22

Full Member level 4
Joined
Jun 7, 2005
Messages
190
Helped
20
Reputation
40
Reaction score
5
Trophy points
1,298
Activity points
2,929
Re: Delay in 89c51

hi

ezshereef is right, you have 2 timers inside the AT89c51. timer 0 and timer 1, you cane use them to generate very accurate delay or scheduled events, they are easy to use.

keil has simulation to these timers you can use to calculat the delay u want
best regards
Ahmed
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top