Hello,
We are using the ADC on the RM48 in continuous conversion mode however we seem to get low values read but do not understand why. I have cut back our configuration to have just one enabled channel but we still get low values read, could this be a timing configuration problem that prevents the ADC reading a complete signal each sample period? Our ADC functions are shown below, an initialization routine is called to start conversions then we periodically call adcGetData to grab the latest values. We have a buffer of reorganized values for use in our application which is what we process in the for loop below. Our reference voltage is 3V and we have 12bit conversions set up. With a test input ranging from 0.57V to 2.7V I only see raw counts of 673 to 1222, could this be due to sample periods being insufficient?
#include "adc.h" /* adc group 0 data array */ adcData_t adcG0_Data_l[UNI_P_L_NUM_ADC_INPUTS]; /* ADC converted data */ float uni_p_l_adc_raw_f[UNI_P_L_NUM_ADC_INPUTS] = {0,0,0,0,0,0,0,0}; uint32 uni_p_l_adc_raw_i16[UNI_P_L_NUM_ADC_INPUTS] = {0,0,0,0,0,0,0,0}; void uni_p_l_in_adc_init(void) { adcInit(); adcStartConversion(adcREG1, adcGROUP1); }/* end uni_p_l_in_adc_init */ void uni_p_l_in_adc_read(void) { uint8 i = 0; adcGetData(adcREG1, adcGROUP1, adcG0_Data_l); for( i=0; i<UNI_P_L_NUM_ADC_INPUTS; i++) { uni_p_l_adc_raw_f[uni_p_l_adcG0_ch_map[adcG0_Data_l[i].id]] = ((float)(adcG0_Data_l[i].value) / 4096) * 3; uni_p_l_adc_raw_i16[uni_p_l_adcG0_ch_map[adcG0_Data_l[i].id]] = ((uint32)(adcG0_Data_l[i].value * 1000)) / 4096 * 3; } }