Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: Volatile modifier

2012-04-20 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, R E Purcella <repurcella@...> wrote:
> Use volatile variables in ISR routines or 
> strange things happen.
That sure sounds like a superstition, somewhat akin to "don't walk under ladders or bad things will happen".  Neither statement suggests any understanding of an actual causal relationship.

You should know why it is necessary or not necessary in each particular case.  I would aver that an ISR that cannot be interrupted will work perfectly well without volatile (and if present it can be safely cast away) for normal variables located in single port RAM with no DMA activity.  If you don't know why that is true then you don't yet understand the issue.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.