Programming an msp430 in CCSTUDIO. In second and third line the expressions compile fine without parentheses, but with parentheses as shown in second line, they fail to compile at the line where the macro is used. Why does it fail?
#define LED2 BIT0; // P1.0 : Green LED
#define LED2on (P1OUT |= LED2) // P1.0 high
#define LED2off P1OUT &= ~LED2 // P1.0 low
...
LED2on; //line 32
>> Compilation failure
subdir_rules.mk:9: recipe for target 'main.obj' failed
"../main.c", line 32: error #18: expected a ")"
"../main.c", line 32: error #29: expected an expression
Your problem is here:
#define LED2 BIT0;
It should be:
#define LED2 BIT0
Otherwise your line 32 expands to this:
(P1OUT |= BIT0;);
Which is wrong, of course.