I'm getting error like "expected an statement"
my code is as follows
#define IN_Tamper    0X00001000     /*P2.12 = EINT2*/
#define DIR_IN_Tamper    { FIO2DIR &= ~0X00001000 ; } 
/* main */
DIR_IN_Tamper(); 
if(((IN_Tamper >> 12) & 0x01) == 1)
            BUZZER_ON();
         else
            BUZZER_OFF();   
I'm getting error saying
Expected an statement for DIR_IN_Tamper();
expected a statement for the else part.....
The C preprocessor is (at least in the way you use it) just a simple search-and-replace, so you're effectively running
/* main */
{ FIO2DIR &= ~0X00001000 ; } (); 
This doesn't make any sense. Remove the parentheses in the line
DIR_IN_Tamper(); 
For BUZZER_ON and BUZZER_OFF, you want to remove the parentheses as well. If the macro isn't enclosed in curly braces, you also want to add those, like
if(((IN_Tamper >> 12) & 0x01) == 1) {
    BUZZER_ON
} else {
    BUZZER_OFF
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With