Page 1 of 1

AVR error incrementing unsigned long variable inside interrupt

Posted: Fri Apr 23, 2021 12:38 am
by pirvcb
Hello there.
I cant solve this error.
Incrementing an unsigned long variable inside a timer interrupt (atmega2560), when it reaches the border limit of 0xFF, at the next step, 0x100, it gets corrupted.
Tried with C icon and declred it in supplementary code as VOLATILE but no way.
Tried also to understand as implementing an ATOMIC function but without succes.
Does someone drive me in the right direction?

Re: AVR error incrementing unsigned long variable inside interrupt

Posted: Fri Apr 23, 2021 10:12 am
by kersing
Could you post your failing program (flowcode source) so we can take a look at what might be the issue?

Re: AVR error incrementing unsigned long variable inside interrupt

Posted: Tue Apr 27, 2021 12:53 am
by pirvcb
I finally found the problem. In next days i'll post examples for wrong and solutin scenarios. Thnks anyway!