Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Re: Volatile modifier

2012-04-20 by Robert Adsett

On 4/20/2012 7:35 PM, Don Kinzer wrote:
> --- 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.

Yes, and there are cases where volatile is necessary even though the 
value cannot be read and will not change unexpectedly.

Robert
-- 

  From the Divided by a Common Language File (Edited to protect the guilty)
ME - "I'd like to get Price and delivery for connector Part # XXXXX"
Dist./Rep - "$X.XX Lead time 37 days"
ME - "Anything we can do about lead time?  37 days seems a bit high."
Dist./Rep - "that is the lead time given because our stock is live....
we currently have stock."

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.