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.

[AVR] ATMEGA32 FCPU16000000L Warnings

Status
Not open for further replies.

ANS HAFEEZ

Advanced Member level 4
Full Member level 1
Joined
Jul 25, 2013
Messages
101
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Location
LAHORE,PAKISTAN
Visit site
Activity points
1,911
i am using ATMEL STUDIO 6



Code C - [expand]
1
2
3
#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>



when i write this there is No Error No warning and No Message
but whn i write it as

Code C - [expand]
1
2
3
#include <avr/io.h>
#include <util/delay.h>
#define F_CPU 16000000UL



Warning 1 #warning "F_CPU not defined for <util/delay.h>" [-Wcpp]
Warning 2 "F_CPU" redefined [enabled by default]


Proteus Simulation is different for bath codes
but i did not get whats the problem is???
 
Last edited by a moderator:

i am using ATMEL STUDIO 6


#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>

when i write this there is No Error No warning and No Message
but whn i write it as

#include <avr/io.h>
#include <util/delay.h>

#define F_CPU 16000000UL

Warning 1 #warning "F_CPU not defined for <util/delay.h>" [-Wcpp]
Warning 2 "F_CPU" redefined [enabled by default]


Proteus Simulation is different for bath codes
but i did not get whats the problem is???


delay.h uses F_CPU to calculate number of ticks for exact delay, thats why you need to specify it before delay.h

gaurav
 

You have to define F_CPU above the delay.h header file.

Because delay.h needs it to calculate delay and if you had not defined it, then by default setting will get activated.
Check your delay.h header file, there is a line

Code C - [expand]
1
2
3
#ifndef F_CPU
#define F_CPU xxxxxx
#endif

 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top