Hello. Please advise me. When I write the program below and run it in attiny, I don't see the first two states (130 and 150) of the variable "a" in the ISR routine, because it seems that the variable "a" is only updated at the end of the loop(), so after some time I only see "244". How do I store the contents of the variable in the middle of the loop() loop so that I can see all three values of the variable sequentially in the interrupt routine? Thank you.
// attiny 1614
byte a;
void setup() {
Serial.begin(9600);
RTC.CLKSEL = RTC_CLKSEL_INT32K_gc;
RTC.PITINTCTRL = RTC_PI_bm;
while(RTC.PITSTATUS & RTC_CTRLABUSY_bm){}
RTC.PITCTRLA = RTC_PERIOD_CYC8192_gc | RTC_PITEN_bm;
delay(100);
sei();
}
ISR(RTC_PIT_vect){
RTC.PITINTFLAGS = RTC_PI_bm;
Serial.println(a);
}
void loop() {
a=130;
delay(1000);
a=150;
delay(1000);
a=244;
delay(1000);
}