[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] volatile...
From: |
MWare |
Subject: |
Re: [avr-gcc-list] volatile... |
Date: |
Thu, 14 Dec 2006 08:47:50 -0500 |
Hello Javier,
Javier Almansa Sobrino wrote:
> Hi everybody. I've a little stupid question....
>
> What's the differece between a volatile variable in a funcion and the
same variable not volatile?
>
> I've noted a non volatile variable is like don't exists (I think).
>
Despite what some have said about this question, I don't think it is
"stupid" as it pertains AVR-GCC (and other microcontroller compilers).
The way I look at it is:
---If you want a GLOBAL to be changed in BOTH real-time-interrupts AND in
the foreground, you should use VOLATILE (so that the compiler knows this
variable is capable of changing at any time and dependent code is not
optimized out of existence).
---If you want a GLOBAL to be changed in EITHER real-time-interrupts OR
in the foreground, you don't have to use VOLATILE (but it doesn't hurt).
Regards,
- Mike Ware
- [avr-gcc-list] PPP protocol, andi suhandi, 2006/12/11
- RE: [avr-gcc-list] PPP protocol, Eric Weddington, 2006/12/11
- Re: [avr-gcc-list] volatile..., Clemens Koller, 2006/12/14
- Re: [avr-gcc-list] volatile...,
MWare <=
- RE: [avr-gcc-list] volatile..., Larry Barello, 2006/12/14
- RE: [avr-gcc-list] volatile..., Eric Weddington, 2006/12/14
- Re: [avr-gcc-list] volatile..., Roger Furer, 2006/12/14
- Re: [avr-gcc-list] volatile..., Graham Davies, 2006/12/14
- Re: [avr-gcc-list] volatile..., David Brown, 2006/12/15
- Re: [avr-gcc-list] volatile..., Graham Davies, 2006/12/15
- Re: [avr-gcc-list] volatile..., Paulo Marques, 2006/12/15
- Re: [avr-gcc-list] volatile..., Dave Hansen, 2006/12/15
- Re: [avr-gcc-list] volatile..., Paulo Marques, 2006/12/15
- Re: [avr-gcc-list] volatile..., Dave Hansen, 2006/12/15