Usage of Sample and Hold Circuitry for High Impedance Measurement
311
SNIU028A – February 2016 – Revised April 2016
Copyright © 2016, Texas Instruments Incorporated
ADC12 Overview
8.15.1 C Code Example
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
}
8.16 ADC Configuration Examples
8.16.1 Software Initiated Conversions
The following example code demonstrates how to configure ADC12 to initiate a sequence of conversions
triggered by software.
Requirement: 10 conversions need to be sequenced during a single session with triggering done via
firmware. The required channels are as follows: Conversions = 09, 10, 02, 02, 02, 04, 04, 04, 12 and 14.
Here the maximum number of conversion is set to 9 and the ADC Sequence Select Register is configured
to:
Bits
Field Name
Channel Select Value
SEQCHSEL0
4:0
SEQ00
9
9:5
SEQ01
10
14:10
SEQ02
2
SEQCHSEL1
Bits
Field Name
Channel Select Value
4:0
SEQ03
2
9:5
SEQ04
2
14:10
SEQ05
4
SEQCHSEL2
Bits
Field Name
Channel Select Value
4:0
SEQ06
4
9:5
SEQ07
4
14:10
SEQ08
12
SEQCHSEL3
Bits
Field Name
Channel Select Value
4:0
SEQ09
14
9:5
SEQ10
X
14:10
SEQ11
X
A conversion session is initiated by firmware writing to the software start bit (SW_START) in the ADC
control register. When the sequence completes all the requested conversions, the sequencer sits idle
waiting for another software start bit transition from 0 to 1. The conversion results are placed in the ADC
result buffers.