Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Question regarding interrupt routine in AT90CAN128

2005-08-10 by Brian Dean

On Tue, Aug 09, 2005 at 11:11:39AM -0500, Thomas Keller wrote:

>    Or simply declare the variable as a global identifier.  Globally
> declared variables are visible in all modules/files.

That would be insufficient.  The 'volatile' attribute lets the
compiler know that the variable could be modified outside the
compiler's realm of awareness.  Thus, it should not optimize accesses
to the variable by caching it's value in a register.  There are other
reasons to use volatile also.

But the OP specifically mentioned a "register" value which leads me to
believe that the problem is not a 'volatile' variable, but that
something else is modifying the register outside the interrupt
routine.  Probably just a case of not accounting for everything that
uses that particular register.

>   Which C compiler is this, anyway?

I don't think the OP said - I actually assumed assembly since he
mentioned "register" as opposed to a variable.

-Brian
-- 
Brian Dean
ATmega128 based MAVRIC controllers
http://www.bdmicro.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.