This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BugReport: Operator & and == Precedence in MSP430 Compiler

Other Parts Discussed in Thread: MSP430G2452

The following code:

if (P1IN & BIT5 == 0)
    isCharging = 1;

Can not work prospectively(test P1.5 input bit if reset), because the Compiler doesn't generate any machine code.

As we all know, operator & should has a high priority then operator ==.

When I modify the code like this:

if ((P1IN & BIT5) == 0)
    isCharging = 1;

It's OK now.

Version: MSP430 C/C++ Compiler v4.0.0 (cl430.exe)

IDE: CCS 5.1 

Test Device: MSP430G2452