Hello,
I wanted confirmation if I understand how adc conversion works for each channel.
In Halcogen, the ADC1, Group 1 configuration is:
The following routine evaluates each and every channel defined above. So every invocation of bsp_ADC1_GET, Channels 0,1,2,3,4,5,6,8,10,11,12,13,14,15,16,18 all get converted. Is this correct?
uint16 bsp_ADC1_GET (uint8 terminal) { adcData_t adc_data; adcData_t *adc_data_ptr = &adc_data; /** - Start Group ADC Conversion */ adcStartConversion_SelChn(adcREG1, terminal, ADC_FIFO_SIZE, ADC_SUBGROUP_01); /** - Wait for ADC Group conversion to complete */ while(!adcIsConversionComplete(adcREG1, ADC_SUBGROUP_01)); /** - Read the conversion result */ adcGetSingleData(adcREG1, ADC_SUBGROUP_01, adc_data_ptr); return(adc_data_ptr->value); }
The following routine, simply recalls the last converted value for a channel from RAM. It does not actually do any conversion itself. Correct?
void adcGetSingleData(adcBASE_t *adc, unsigned group, adcData_t *data) { unsigned buf; adcData_t *ptr = data; /** - Get conversion data and channel/pin id */ buf = adc->GxBUF[group].BUF0; ptr->value = (unsigned short)(buf & 0xFFFU); ptr->id = (unsigned short)((buf >> 16U) & 0x1FU); //!< int to unsigned short adc->GxINTFLG[group] = 9U; }
If adcGetSingleData truly does not do any conversion for a single channel, is there any way to request for a single channel conversion, without having to convert everything in the group?
Thanks.
Ubaid