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

bailey at peak.org bailey at peak.org
Fri Apr 11 09:34:47 PDT 2008


    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.

2)  Use the "monitor" pragma on the function

This doesn't work well since there are multiple sections of code in the
function that need protection (chained accesses to the HW multiplier), and
turning interrupts off for the duration increases the latency to the point
where I'm losing high speed interrupts.

3)  Use a simple function to read the value of the SR and return it.

This works, but adds more overhead to the function execution than I like.

    So, anyone have another approach they like, or perhaps a clever way of
implementing one of the above?  (What I really need is an intrinsic ala
IAR, etc :)

    Cheers,
           Kirk Bailey
           Willamette RF, Inc.




More information about the Icc-430 mailing list