Vincent Espindola

MCF52223 Direct Port Bit setting?

Discussion created by Vincent Espindola on Nov 28, 2007
Latest reply on Nov 29, 2007 by Vincent Espindola
I am trying to define each ports bit so i can address them individually is there a way do to this. Here is a copy of how i initializd each port I am using:

MCF_GPIO_PUAPAR = 0
| MCF_GPIO_PUAPAR_RXD0_RXD0
| MCF_GPIO_PUAPAR_TXD0_TXD0;
///////////////////////////////////////
//Set Port TA to initialize STEP0, Dir0, Home0, Limit0
    MCF_GPIO_PTAPAR = 0x00;
    MCF_GPIO_DDRTA = 0x0C;
/////////////////////////////////////
//Set Port TC to initialize STEP1, Dir1, Home1, Limit1
    MCF_GPIO_PTCPAR = 0x00;
    MCF_GPIO_DDRTC = 0xFF;
/////////////////////////////////////////
//Set Port UC to initialize STEP2, Dir2, Home2, Limit2
    MCF_GPIO_PUCPAR = 0;
    MCF_GPIO_DDRUC = 0x0C;
///////////////////////////////////
//Set Port UB to initialize LEDs
    MCF_GPIO_PUBPAR = 0;
    MCF_GPIO_DDRUB = 0x0F;
///////////////////////////////////////
//Set Port AN to initialize Analog Inputs
    MCF_GPIO_PANPAR = 0;
    MCF_GPIO_DDRAN = 0xFF;
////////////////////////////////////////
//Set Port NQ to initialize Switch Inputs
    MCF_GPIO_PNQPAR = 0;
    MCF_GPIO_DDRNQ = 0x00;
////////////////////////////////
 
I basically want to give each bit a name for example
 
#define LED0    PORTUB pin1
 
so later i can just say LED0=1; and so on.
 
I know this is possible with other microprocessor, but i have not been successful yet
 
Thank you
 

Outcomes