error: #29: expected an expression in C

arm, arm7, c, embedded, keil

Solution

The braces and semicolon in your macro are wrong. Use:

#define READ_TAMPER_PIN()   ((FIO2PIN & PIN_TAMPER) >> 12)

Problem

my code contains ``` #define READ_TAMPER_PIN() {((FIO2PIN & PIN_TAMPER) >> 12) ;} ``` where `PIN_TAMPER` is again a macro- ``` #define PIN_TAMPER 0x00001000; ``` in one of the header file, and it is called in main() like ``` x = READ_TAMPER_PIN(); ``` it gives an error saying "error: #29: expected an expression" what could be possible mistake that I'm making here??

Original source