Sorry for the crappy title I Don't know how to ask what im looking for. Here is my problem. I have a msp430 processor connected to a bunch of transceivers. I have individual discrete outputs going to going to the re/de select of each transceivers. Normal I define the select of each chip like this
#define enable_port_rx P1OUT &= ~BIT2
#define disable_port_rx P1OUT |= BIT2
#define enable_port_tx P1OUT |= BIT1
#define disable_port_tx P1OUT &= ~BIT1
I have a struct for each transceivers that i put in an array so that I can iterate though them with loops.
extern motors m[10];
typedef struct
{
unsigned char address;
unsigned int value;
unsigned int xdata[10];
} motors;
I want to be able to enable/disable rx/tx from the struct. I want to do something like this.
m[0].enable_tx = P1OUT |= BIT1;
m[0].disable_tx = P1OUT &= ~BIT1;
m[1].enable_tx = P3OUT |= BIT2;
m[1].disable_tx = P3OUT &= ~BIT2;
so that i can call them when i need them..
m[0].disable_tx; //disable tx
m[1].disable_tx; //disable tx
I thought something like this below would work. That is i saved that pointer to the register and the bit needed that i could access them when need. but this does not work.
//inside strut
volatile unsigned char *rxPxOUT;
unsigned char rxBITx;
volatile unsigned char *txPxOUT;
unsigned char txBITx;
//setup
m[0].txPxOUT=&P1OUT;
m[0].txBITx = BIT1;
//function call
&m[0].txPxOUT &= ~m[0].txBITx;
Thanks in advance