This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Macro Expansion Error

Other Parts Discussed in Thread: MSP430FG4618

Hi,

A part of my sample project (CCS) is given below. I take the error code 138 for the last row but it seems a compiler bug. Can you please examine and comment for me?

Best Regards!

 

// An example with CCS Version: 6.0.1.00040

// MCU : MSP430FG4618

 

// preprocessor definitions in include file

#define PXSEL_MCULED           P3SEL,BIT0

#define CLR_PIN(port,pin)       port&=(~pin)

 

// Statements in source file

CLR_PIN(P3SEL,BIT0);       // true –    Macro Expansion : P3SEL&=(~(0x0001))

CLR_PIN(PXSEL_MCULED);     // false -   Macro Expansion : P3SEL,(0x0001)&=(~)   ERROR#138

 

 

 

 

  • Preprocessing simply does not support what you are attempting to do.  In this macro invocation ...

    Serkan Buyukabali said:
    CLR_PIN(PXSEL_MCULED);

    PXSEL_MCULED is replaced wherever "port" appears in the macro definition.  After that replacement, then PXSEL_MCULED expands to P3SEL,(0x0001).  Every C compiler orders macro expansion that way.  I'm ignoring other errors in this situation, and focusing only on this one central error.

    Thanks and regards,

    -George