[Icc-430] Reading MSP-430 status register from C....

bailey at peak.org bailey at peak.org
Fri Apr 11 10:55:54 PDT 2008


Jerry,
    Thanks for the suggestion.  The only problem that I see is that the
function in question can be called both from the background and a couple
of interrupt routines.  Having a single location for the saved status seems
destined to lead to a corrupted saved interrupt status when an interrupt
(that also calls the function), occurs between when:

asm("mov r2, &0x200");

gets executed and the following _DINT(); that disables the interrupts.

    In the (more), common case where the function only got called from a
single thread I think your idea should work.  Am I understanding your
approach correctly?

    Kirk Bailey
    bailey at peak.org

> At 09:34 AM 4/11/2008, bailey at peak.org wrote:
>>     Hi.  I'm looking for suggestions of good ways to read the MSP-430
>>status register from within a function in C as part of an effort to
>>selectively disable/restore the GIE flag.  I've played with various
>>approaches:
>>
>>1)  Using inline asm ala: asm("mov r2,%saveSR")
>>
>>This doesn't work since the function it is called from is complex and the
>>compiler apparently can't free up a register to store the local variable
>>saveSR in.
>
> Define a variable in a fixed location of memory and move to that:
>
> #pragma abs_address 0x200
> unsigned int sr_copy;
> #pragma end_abs_address
>
> asm("mov r2, &0x200");
>
>
> --
> Jerry Durand, Durand Interstellar, Inc.  www.interstellar.com
> tel: +1 408 356-3886, USA toll free: 1 866 356-3886
> Skype:  jerrydurand
> _______________________________________________
> Icc-430 mailing list
> Icc-430 at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-430
>




More information about the Icc-430 mailing list