Witam, program ktory ma naprzemian zapalac portb i portd wykonuje obsluge timera1 tylko raz. Prosze o pomoc dla laika
oto kod programu:
uint8_t volatile counter = 0;
uint8_t volatile flaga = 1;
int main(void) {
sei();
DDRB = 0xFF;
DDRD = 0xFF;
PORTD = 0xFF;
PORTB = 0x00;
TCCR1B |= (1<<WGM12);
TCCR1B |= (1<<CS12) | (1<<CS10);
OCR1B = 2000;
TIMSK |=(1<<OCIE1B);
while(1) {
if(flaga)
{
PORTD = ~PORTD;
PORTB = ~PORTB;
flaga = 0;
}
}
}
ISR(TIMER1_COMPB_vect) {
flaga = 1;
}