SNIU028D February 2016 – September 2020 UCD3138 , UCD3138064 , UCD3138064A , UCD3138128 , UCD3138A , UCD3138A64
The following example code demonstrates how to configure the ADC 12 for dual sample and hold operation. In this example AD04 and AD00 are configured to measure simultaneously.
void init_ADC_polled(void)
{
AdcRegs.ADCCTRL.bit.MAX_CONV = 2; // A total of 3 measurements
AdcRegs.ADCCTRL.bit.SINGLE_SWEEP = 1;
AdcRegs.ADCCTRL.bit.ADC_EN = 1;
AdcRegs.ADCSEQSEL0.bit.SEQ0 = 4; // First measure AD04
AdcRegs.ADCSEQSEL0.bit.SEQ1 = 3; // Second measure AD03
AdcRegs.ADCSEQSEL0.bit.SEQ2 = 0; // Third measure AD00
AdcRegs.ADCSEQSEL0.bit.SEQ0_SH = 1;
// Sample and Hold AD04 for simultaneous measurement with a following channel
AdcRegs.ADCCTRL.bit.BYPASS_EN = 6;
// 6 is "110 in binary", which means AD00 is the
// following/Converting channel that is measured together with AD04
}