AVR error incrementing unsigned long variable inside interrupt

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
pirvcb
Posts: 12
Joined: Wed Mar 06, 2019 9:20 am
Has thanked: 3 times
Been thanked: 1 time
Contact:

AVR error incrementing unsigned long variable inside interrupt

Post 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?

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: AVR error incrementing unsigned long variable inside interrupt

Post by kersing »

Could you post your failing program (flowcode source) so we can take a look at what might be the issue?
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

pirvcb
Posts: 12
Joined: Wed Mar 06, 2019 9:20 am
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: AVR error incrementing unsigned long variable inside interrupt

Post by pirvcb »

I finally found the problem. In next days i'll post examples for wrong and solutin scenarios. Thnks anyway!

Post Reply