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

Status
Not open for further replies.

ashish.master2

Newbie level 5
Joined
Jan 4, 2010
Messages
9
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,333
i am learning atmega 8 microcontroller.
i am having a problem in using the delay function
i have seen some programs
some define # define F_CPU 1000000Ul
i want to ask which clock frequency they define, external clock or internal clock.
also what if i do not define it in my program, which clock will it be using internal clock or external clock.
 

Define F_CPU is used to define the clock frequency which you are using in your hardware. You may use either internal or external frequency.

If you dont define it will create error.

Nandhu
 

i am not using it, it is not showing any error, that why i was asking if we dont define it, which frequency it means
 

maybe it's defined at the makefile... (at winavr you have a makefile generator which comes with a 8MHz F_CPU defined value)... but I think it's not used in very simple programs... just when you add the #include <utils/delay.h> or maybe the baudrate calculator... If you don't use any of them... I think the program doesn't take in account the F_CPU constant (but i'm not sure... for me, it's always defined at the makefile)

Also! if you are plannig to make a huge program with many C files... it's better to have just one F_CPU define... again.. at the makefile... :) so it doesn't mess with multiple F_CPU values at individual files...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top