I am using the C30 compiler for microchip dsPIC30F4013 and have a header file with the following:
I want to now base that definition off of a dip switch, something like (in C):
The problem is , i cant get the definitions to work globally if i do it in C and i can't use #if(PORTBbits.RB1 == 1) in preprocessor because, well it is preprocessor and therefore has no idea of the port state yet, and C30 compiler won't let you put a "." in an #if statement. Any Ideas?
Code:
#define LED LATBbits.LATB0
I want to now base that definition off of a dip switch, something like (in C):
Code:
TRISBbits.TRISB1 = 1
if (PORTBbits.RB1)
{
TRISBbits.TRISB0 = 0
#define LED LATBbits.LATB0;
}
else
{
TRISBbits.TRISB0 = 0
#define SWITCH PORTBbits.RB0
}
The problem is , i cant get the definitions to work globally if i do it in C and i can't use #if(PORTBbits.RB1 == 1) in preprocessor because, well it is preprocessor and therefore has no idea of the port state yet, and C30 compiler won't let you put a "." in an #if statement. Any Ideas?