No oczywiście
to był ten błąd. Teraz już wszystko działa tak jak powinno.
Przy okazji zapytam o jeszcze jedną rzecz związaną z trybem asynchronicznym Timera2.
Inicjalizuję go tak:
język c
Musisz się zalogować, aby zobaczyć kod źródłowy. Tylko zalogowani użytkownicy mogą widzieć kod.
I teraz zgodnie z notą:
If Timer/Counter2 is used to wake the device up from Power-save or ADC Noise Reduction
mode, precautions must be taken if the user wants to re-enter one of these modes: If reentering
sleep mode within the TOSC1 cycle, the interrupt will immidiately occur and the
device wake up again. The result is multiple interrupts and wake-ups within one TOSC1 cycle
from the first interrupt. If the user is in doubt whether the time before re-entering Power-save or
ADC Noise Reduction mode is sufficient, the following algorithm can be used to ensure that
one TOSC1 cycle has elapsed:
a. Write a value to TCCR2x, TCNT2, or OCR2x.
b. Wait until the corresponding Update Busy Flag in ASSR returns to zero.
c. Enter Power-save or ADC Noise Reduction mode.
trzeba poczekać na wyzerowanie flagi Update Busy Flag
Z paskudnym delayem wygląda to u mnie tak:
język c
Musisz się zalogować, aby zobaczyć kod źródłowy. Tylko zalogowani użytkownicy mogą widzieć kod.
i pojęcia nie mam jak to zamienić na pętlę oczekującą na wyzerowanie tej flagi.