expression must be a modifiable lvalue

Discussion in 'Programmer's Corner' started by Jswale, Jan 7, 2016.

  1. Jswale

    Thread Starter Member

    Jun 30, 2015
    121
    6
    Hi All,

    Using MSP430F6679 on IAR Workbench..

    I'm trying to disable GIE...

    Code (C):
    1. /************************************************************
    2. * STATUS REGISTER BITS
    3. ************************************************************/
    4.  
    5. #define C                   (0x0001u)
    6. #define Z                   (0x0002u)
    7. #define N                   (0x0004u)
    8. #define V                   (0x0100u)
    9. #define GIE                 (0x0008u)
    10. #define CPUOFF              (0x0010u)
    11. #define OSCOFF              (0x0020u)
    12. #define SCG0                (0x0040u)
    13. #define SCG1                (0x0080u)
    This is the register in the MCU library.

    When I put in GIE=0; the error comes up, so my question is how do I set and unset this bit?

    Cheers!
     
  2. Jswale

    Thread Starter Member

    Jun 30, 2015
    121
    6
    Nevermind, I have found an answer!

    _BIC_SR(GIE); (if anyone is interested).
     
  3. dannyf

    Well-Known Member

    Sep 13, 2015
    1,782
    360
    Those macros are constant - as such they cannot be changed, and they are defined masks on the status register. All you need is to use the masks to set / clear the respective bits in the status register.
     
Loading...