The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.
So far in May, you have voted 0 times ou of a total of 20 votes by the community.
Please help us clean the archives from unuseful discussion threads by using the voting system! Details here.
Is this thread worth a thumbs up?
C Preprocessor levels - gripen_fighters - Jan 24 1:17:10 2012
Is there an option to specify IAR preprocessor to add some levels of
recursion?
Here is my problem. I have the following defines:
#define GPIO_PORT1 P1
#define PortHigh(port, pin) port##OUT |= pin
When I use the macro PortHigh(GPIO_PORT1, BIT2);
the output is GPIO_PORT1OUT |= BIT2; which is wrong, and different from P1OUT |=
BIT2;
(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )Re: C Preprocessor levels - distantship101 - Jan 24 2:37:47 2012
Just use an intermediate macro:
#define GPIO_PORT1 P1
#define POUT(port) port##OUT
#define PortHigh(port, pin) POUT(port) |= pin
--- In m..., "gripen_fighters"
wrote:
>
> Is there an option to specify IAR preprocessor to add some levels of
recursion?
>
> Here is my problem. I have the following defines:
>
> #define GPIO_PORT1 P1
> #define PortHigh(port, pin) port##OUT |= pin
>
> When I use the macro PortHigh(GPIO_PORT1, BIT2);
> the output is GPIO_PORT1OUT |= BIT2; which is wrong, and different from P1OUT
|= BIT2;
>

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )