On Tue, Apr 17, 2012 at 7:03 AM, David Brown <da...@westcontrol.com> wrote: > You have to be particularly careful about read-modify-write codings. > The msp430 can do some of these actions atomically, but it is possible > that the compiler will split the actions up. For example, if you write > "a += 1; b = a" then then compiler might read "a" into a register, do > the addition, then save the value to "a" as three separate actions, so > that it can re-use the saved value for "b".
If you declare "a" as "volatile," that will tie the compiler's hands and force the reads and writes to occur exactly as specified. Any variable shared between ISR-land and normal code should be "volatile" to avoid surprises like this. -William ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users