Hi. We are using the RM48L952ZWT Hercules. and our readings do not seem accurate according to the equation with data resolution set in HalCoGen to 12 bit.
equation (ADC_Pin_Value_Volts/VREF_ADC) * (4095)
1. Is VREF_ADC on the RM48L952 connected to Terminal V15 (VREFHI) which we measure with voltmeter = 3V. Or is VREF_ADC connected to another terminal i.e., Vdd)? There is no option in HalCoGen to specify what VREF_ADC should be connected to, etc.
2. So if ADC_Pin_Value in Volts is measured by voltmeter = 1.975V and Terminal V15(what we assume is VREF_ADC) = 3V then given the equation the reading = 2696, but our reading using HalCoGen getting the adc single data function (the return value in code below) after conversion is 3936 (really off). Is there additional configuration we need to do in HalCoGen so the ADC conversions are accurate, if our assumptions above correct?
adcData_t adc_data;
adcData_t *adc_data_ptr = &adc_data;
/** - Start Group ADC Conversion
*/
adcStartConversion_SelChn(adcRegister, adcPin, 1, adcGroup);
/** - Wait for ADC Group conversion to complete */
while(!adcIsConversionComplete(adcRegister, adcGroup));
/** - Read the conversion result
*/
adcGetSingleData(adcRegister, adcGroup, adc_data_ptr);
return(adc_data_ptr->value);
Thank You Again.