I'm trying to use a 8MHz Oscillator on an atmega328p. this a part of the whole schematic :
to that I've set the Fuse byte as calculated
then I've set the calculate values in the project :
To make sure that the uc ist correctly runnion on 8MHz, since I don't have an oscilloscope, I'm trying to toggle a LED each 1 sec, here is the code I've wrote for that :
#define F_CPU 8000000
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRD |= (1 << PD5);
while(1){
PORTD |= (1 << PD5);
_delay_ms(1000);
PORTD &= ~(1 << PD5);
_delay_ms(1000);
}
return 0;
}
As far as I can see the lED take 8sec to change its status ! when I change the value of F_CPU
to 1MHz the toggle is than correct, which means to me that I'm still running the internal oscillator ?
Any idea what I'm missing here ? thanks in advance !