Yahoo Groups archive

AVR-Chat

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

Message

Re: Volatile modifier

2012-04-18 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, "bayramdavies" <Yahoo37849@...> wrote:
>Do you have a suggestion on how we can achieve clarity?

I think this statement describes the issue:

If while examining a particular function or smaller code sequence it is determined that (a) the content of a storage location read by that code sequence might be changed by a means that cannot be deduced, or (b) the content of a storage location modified by that code sequence might be read by a means that that cannot be deduced, or (c) the act of reading or writing a storage location might produce side effects, then the storage declaration must have the volatile modifier.

Examples of (a) include:
- storage modified by an ISR
- storage modified by another task/thread/process
- storage in multi-port memory accessed by an external writer
- storage modified by DMA
- storage represented by hardware registers

Examples of (b) include:
- storage read by an ISR
- storage read by another task/thread/process
- storage in multi-port memory accessed by an external reader

Examples of (c) include:
- storage represented by hardware registers

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.