[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] volatile...

From: Paulo Marques
Subject: Re: [avr-gcc-list] volatile...
Date: Fri, 15 Dec 2006 17:54:00 +0000
User-agent: Thunderbird (X11/20060909)

Galen Seitz wrote:
One more suggestion...

If you are using global volatiles shared between an interrupt and mainline code, interrupt handler performance may be improved by moving the volatile into a temporary variable.

Yes, but this doesn't save you the trouble of disabling interrupts around the access to the variable in the main program, at which point you'll probably want to write a special function to access it (so that you don't sprinkle your code with interrupt disable / enable) at which point you might as well stuff a volatile in there, and avoid changing the interrupt code logic.

You can defend the use of volatile for 8 bit vars because all accesses are atomic anyway, but when we reach 16 bits (or 32, ...) there really isn't much point in _declaring_ the variable volatile at all, IMHO.

Paulo Marques - www.grupopie.com

"The face of a child can say it all, especially the
mouth part of the face."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]