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.....
#define DIR_IN_Tamper(FIO2DIR) { FIO2DIR &= ~0X00001000 ; }
; and call likeDIR_IN_Tamper(FIO2DIR);
what isFIO2DIR
? – TarragonaFIO2DIR
? if its macro then consider @phihag's answer. If its variable you wants to pass then defined like macro function as I suggested. – Tarragona{}
is used because programmer wants to give complete statement (including;
). If at the time of macro calling, suppose use forgets;
then it will not cause any error. – Tarragona