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 function for Atmega32

Status
Not open for further replies.

bmn123

Banned
Joined
Nov 23, 2006
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
0
on delay atmega32

Guys, I am trying to use a delay function in Atmega32. I tried the one given by Bibin John and somehow, AVRstudio doesn't handle it properly. I found this function:-

void del100us(unsigned int n){
//delay n 100us
unsigned int x;

while(n--){
x=?????;
while(x--);
}
}

What value of x should I use for the following frequencies?

1M,4M,8M,16M? The value for 16M is given to be 260
 

atmega32 delay function

If it's Winavr (AVR GCC) , the use delays from delay.h

Make sure to set F_CPU t the xtal clock , and make sure to compile with optimisation enabled ... -Os

Do read about the maximum values for the loops (found in the avr-libc , pdf documentation)

/Bingo
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top