Has anyone had troubles with codewarrior 5.1 giving error 2801 when using a freescale define in a macro?
Including header file "mc9s12A64.h".
Using its #define for "PORTA_BIT3" which defines "_PORTAB.Overlap_STR.PORTASTR.Bits.BIT3"
I created macros to turn the bit ON or OFF as follows
#define LED_ON (_PORTA_BIT3 = 1)
#define LED_OFF (_PORTA_BIT3 = 0)
Using this creates the error C2801.
If I change the macros to
#define LED_ON (PORTA = PORTA | PORTA_BIT3_MASK)
#define LED_OFF (PORTA = PORTA & ~PORTA_BIT3_MASK)
where the header file defines PORTA to be "_PORTAB.Overlap_STR.PORTASTR.Byte", it compiles correctly.
The same problem occurs if you want to test a port pin
#define READ_BIT1 (PORTA_BIT1 == 1) // error
but
#define READ_BIT1 ((PORTA & PORTA_BIT1_MASK) == 1) // ok
The only difference between the 2 methods is the last few chars in the defines. Either ".Bits.BIT3" or ".Byte".
I assume that either method would produce the same code but the first method is nicer and easier to do.
Anyone got any ideas or solutions???