I would just like to give you the example of the LED blinking (1 in 1000 ms). My microcontroller is ATmega328P and I am using Atmel Studio.
State 1: If I don't define F_CPU
, LED-blinking is running true. And I am using default fuse settings (Internal oscillator and CKDIV8=programmed).
State 2: If I define F_CPU 8000000UL
, LED-blinking is running 8 times slower and again I am using default fuse settings (Internal oscillator and CKDIV8=programmed).
I don't use an external crystal in both 1.state and 2.state. And same fuse settings. Why do I see this result? Why 8 times slower?
Question 2: Some libraries need F_CPU
value, such as UART. I don't use an external oscillator. What should I write to this value?