Hi,
I'm using ez430-rf2500 (MPS430), I understand how works the ADC with port 2.0 as input, but I need to set another ports as P4.3 (ADC analog input A12).
In the example the program sets P2.0 as ADC10AE0 |= 0x01; but I don't know how to set P4.3 on this way.
Where I could find a document with hexadecimal address for each port?
Thank you.
unsigned short int AnalogDigital()
{
unsigned short int value, a = 125, b = 1023; //1023 as the ADC takes 1 to 1024 is to compensate de float values and reach 1024 in return value.
float factor, motorValueADC;ADC10CTL0 = ADC10SHT_2 + ADC10ON + ADC10IE; // ADC10ON, interrupt enabled
ADC10AE0 |= 0x01; // P2.0 ADC option select??????????????????????????????
P4DIR |= BIT3; // Set P2.0 to output direction
P4SEL |= BIT3;
factor = (float)a / (float)b; //Obtains factor to change ADC value to engines duty cycle value
for (;;)
{
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
value = ADC10MEM; // value between 0 - 1023 gives the POTENTIOMETER
motorValueADC = factor * value; // value constant to work with the motors duty cycle
return motorValueADC; //return constant to motors' function, value now is an integer
}
}