Hodil som do simulátora tvoj posledný výtvor. Kód v ISR sa vykonáva. LED nebliká lebo ako výstup si si zapol PC2, ale v prerušení neguješ PC1.
No... Tak teď se cítím trochu trapně, ta chyba tam byla evidentní.
Program jsem podle té chyby opravil, ale stejně mi to nebliká. Asi si na tohle opravdu budu muset pořídit Windows...
#define __AVR_ATmega328P__
//#define __AVR_ATmega128__
#include <avr/io.h>
#include <avr/interrupt.h>
//#include "Initialization.c"
int main(void){
cli();
// SP = RAMEND;
DDRC = 0xFF;
PORTC = 0;
DDRB = 0xFF;
PORTB = 0;
// initialize Timer1
// disable global interrupts
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
// set compare match register to desired timer count:
OCR1A = 15624;
// turn on CTC mode:
TCCR1B |= (1 << WGM12);
// Set CS10 and CS12 bits for 1024 prescaler:
TCCR1B |= (1 << CS10);
TCCR1B |= (1 << CS12);
// enable timer compare interrupt:
TIMSK1 |= (1 << OCIE1A);
sei(); // enable global interrupts
while(1);
}
ISR(TIMER1_COMPA_vect){
PORTC ^= 0x4;
}
}