Hi everyone,
I'm a little bit confuse, and hope that someone here can point me out what I'm missing...
I'm using an Atmega8-16PU,
Flashed the fuse with :
avrdude -b 19200 -c avrisp -P /dev/tty.usbserial-A9IHTRVJ -p atmega8 -U lfuse:w:0xe4:m -U hfuse:w:0xd9:m
which means.. according to
http://www.engbedded.com/fusecalc/ that I'm using int. osc 8Mhz
In my code, I override OSCAL to OSCCAL = 0xFF; in order to work at its max frequency.
nevertheless, in a for loop (also tried with a 'while'), I'm only toggling a pin LED1_STATE^=(1<<LED1_PIN);
and I'm measuring 1.6Mhz ...
I was thinking that AVR where able to execute one instruction by system clock... here it seems that the FCPU is divided by 4..
-----
I also tried using Timer0 and its overflow interrupt with ;
TCNT0 = 254;
TIMSK |= (1<<TOIE0); // enable interrupt
TCCR0 = 0x01; //prescaler = 1
sei();
ISR(TIMER0_OVF_vect){
LED1_STATE ^=(1<<LED1_PIN);
TCNT0 = 254;
}
and here the signal output 200Khz ....
can someone help me figure it out what is going on ? I am not enough considering the necessary 'instructions' time ?
Many thanks internet
Regards