Part Number: MSP432P4111
Tool/software: TI-RTOS
Hi,
I use the example "adcsinglechannel" in SDK 2.3.. I can read the adc value correctly every time.
but when I move the code in my project, I can read the correct value once in debug mode. After that, I can not get the correct value.
The ADC data seem to change very slowly.
Can you give me some advice.
static uint8_t adc0_data()
{
// uint16_t adcValue0[ADC_SAMPLE_COUNT];
//uint32_t adcValue0MicroVolt[ADC_SAMPLE_COUNT];
uint32_t M_adcValue0 = 0;
uint8_t i;
int_fast16_t res;
uint16_t adcValue0;
uint32_t adcValue0MicroVolt;
float mv;
float dep;
//sleep(1);
// for (i = 0; i < ADC_SAMPLE_COUNT; i++)
//{
res = ADC_convert(adc0, &adcValue0);
if (res == ADC_STATUS_SUCCESS) {
adcValue0MicroVolt = ADC_convertRawToMicroVolts(adc0, adcValue0);
M_adcValue0 = adcValue0MicroVolt;
}
//usleep(100);
//}
//ADC_close (adc0);
mv = (float) M_adcValue0 / 1000;
M_adcValue0 = 0;
dep = ( mv - 520 )/130 * 10;
return (1);
}