Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Help: volatile variable versus volatile array for ISR access

2007-11-03 by Robert Adsett

At 07:26 PM 11/2/2007 -0700, Cat C wrote:
>Hi,
>
>I have this group of variables that I'm updating inside an ISR.
>
>It works fine if I declare like this:
>volatile uint8_t iCh1 = 0, iCh2 = 0, iCh3 = 0, iCh4 = 0, iCh5 = 0, iCh6 = 0;
>
>but not if I change them to an array like this:
>
>volatile uint8_t iCh[6] = {0, 0, 0, 0, 0, 0};
>
>I'm thinking that maybe in the second case somehow only the pointer becomes
>volatile, but... what can I do?

There is no pointer here only an array.  They are not the same thing.

 From cdecl

cdecl> explain volatile int iCh[6]
declare iCh as array 6 of volatile int

Can you post a little more code and an explanation of what behaviour you're 
seeing?  Maybe you're thinking volatile means something other than it 
actually does.

Robert





>Thanks,
>
>Cat
>
>_________________________________________________________________
>Send a smile, make someone laugh, have some fun! Check out
>freemessengeremoticons.ca
>
>
>
>
>Yahoo! Groups Links
>
>
>

"C is known as a language that gives you enough rope to shoot yourself in
the foot."  -- David Brown in comp.arch.embedded
http://www.aeolusdevelopment.com/

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.