I have this problem, not sure if this affects me or everyone. I am using ATmega324PB. Every time when I try to debug something in atmel microchip studio simulator with device selected ATmega324PB, I can't update the TCNT1 register manually.
Suppose if the timer is running and I pause the program. The value in TCNT1 is 100 and I update it to 1000 and then continue the program. The TCNT1 starts from 100 not from 1000.
I tried this exact thing with with another device selected say ATmega2560 and it works, no problem with that device in simulator.
I also tried with real ATmega324PB connected with JTAG. It also works fine. TCNT1 updates okay.
So problem seems to be in the simulator with device ATmega324PB.
Can anyone confirm? Is this a bug?
Here is program to test -
int main(void) { TCCR1B |= (1 << WGM12) | (1 << CS10) ; OCR1A = 100; while (1) { __asm__ __volatile__("nop"); } }