I am trying to do the following in IAR AVR :
#ifdef __IOM16_H #define __disable_watchdog() WDTCR |= (1<<WDTOE); WDTCR &= ~(1<<WDE); #elif __IOM8515_H #define __disable_watchdog() WDTCR |= (1<<WDCE); WDTCR &= ~(1<<WDE); #else #error your processor is not listed, Atmega8515 and ATmega16 are supported, add your own lines. #endif
The compiler reports an error:
Error[Pe029]: expected an expression
When I modify
#elif __IOM8515_H
to
#elif defined(__IOM8515_H)
the error goes away, what is this all about? Why should I use "defined(...)"?
Also, I noticed another thing:
#define RELOAD_TIMER0 ((__UNSIGNED_CHAR_MAX__ - (XTAL_CPU / 64 * 1e-3))) #if (RELOAD_TIMER0 < 255) #error Out of range #error internal algorithm error #endif
The compiler reports an error:
Error[Pe029]: expected an expression
It doesn't want to do the compare..! How can I then do it?