Other Parts Discussed in Thread: TIMAC, Z-STACK
Hi,
I am using a CC2530F128 ADC, and I do not get to read the input (the values is always 0). I have tried using the ADC registers, using TIMAC ADC library and z-stack library and I always get the same result. I also try to read the temperature sensor and the result is 0. But in all cases, the conversion has been completed because the ADCCON1.EOC is set.
The code for read temperature sensor:
ADCCON3 = 0x3E;
while (!(ADCCON1 & 0x80));
// Use all 14 MSB of adcValue
ADC_result = ADCL >> 2;
ADC_result |= ADCH << 6;
The code for read channel 0:
P0DIR = 0x00; //todo entradas
P0SEL = 0xFF; //todo funcion periferico
HalAdcSetReference( HAL_ADC_REF_125V );
ADC_result = HalAdcRead(HAL_ADC_CHN_AIN0, HAL_ADC_RESOLUTION_14);
What it is wrong?
Thanks.
Ruben