question about define F_CPU 16000000UL?

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys,

I have put
#define F_CPU 16000000UL // 16 MHz

but when I give
_delay_ms(2500);

It's not giving me 2.5 seconds,

Any ideas why ?

Thanks for helping

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Div8 fuse

If it is giving you 8 times what you expect, then it is likely you have not set the fuses correctly.

I assume you have a 16MHz crystal attached?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where have you put the #define? Above or below the #include ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes it's 16 Mhz crystal on board,
which fuse bit do you mean ?

is it in writer ? I put CKSEL0 to CKSEL3 into 1 already for external clock....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Where have you put the #define? Above or below the #include ?

below....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

below....

Wrongo pongo.

(It's far better to do it with a -D anyway!)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hohoho I fix it already,thanks guys

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If only the user manual had given details of how to do it eh? Oh wait a minute...

http://www.nongnu.org/avr-libc/u...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And you should pay attention to warnings.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And you have to love cliff's sarcasam :wink: