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.

about crystal frequency and delay in AVR

Status
Not open for further replies.

mvgohil

Newbie level 5
Joined
Oct 5, 2010
Messages
9
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,354
How can i calculate delay in atmega8 or 16 ? Is controller divide crystal by something or what ?

what is the machine cycle for different instruction?
 

Most of the compilers have built in delay routines. You can use that

By the what compiler you are using?
 

Avr studio is not a compiler, but maybe you are using win-avr?
Try including <util/delay.h>
there should be a function called _delay_ms()
 

@oyvdahl

yes there is a header file but in hard ware i should connect how much Mhz crystal for its compatibility.?
 

@oyvdahl

yes there is a header file but in hard ware i should connect how much Mhz crystal for its compatibility.?

You have to define the crystal frequency like this (For example your crystal freq. is 1MHz)
#define F_CPU 1000000UL
after that you should add
#include <util/delay.h>
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top