Single Sweep Operation - Texas Instruments UCD3138 Technical Reference Manual

Digital power supply controller
Hide thumbs Also See for UCD3138:
Table of Contents

Advertisement

ADC Configuration Examples

8.16.2 Single Sweep Operation

The following example code demonstrates how to configure (initialize) the ADC-12 for a start stop
software initiated operation.
Requirement: Configure the ADC-12 in single weep mode and then periodically read the conversion
results and start a new measurement sequence immediately after the read of results.
The function init_ADC_polled(); configures the number of conversions in a single sweep sequence, sets
the order of channels within the sequence and configures the post conversion averaging setting for each
measurement.
void init_ADC_polled(void)
{
AdcRegs.ADCCTRL.bit.MAX_CONV = 6;
AdcRegs.ADCCTRL.bit.SINGLE_SWEEP = 1;
AdcRegs.ADCCTRL.bit.ADC_EN = 1;
AdcRegs.ADCSEQSEL0.bit.SEQ0 = 3;
AdcRegs.ADCSEQSEL0.bit.SEQ1 = 2;
AdcRegs.ADCSEQSEL0.bit.SEQ2 = 4;
AdcRegs.ADCSEQSEL0.bit.SEQ3 = 5;
AdcRegs.ADCSEQSEL1.bit.SEQ4 = 6;
AdcRegs.ADCSEQSEL1.bit.SEQ5 = 7;
AdcRegs.ADCSEQSEL1.bit.SEQ6 = 8;
AdcRegs.ADCAVGCTRL.bit.AVG0_CONFIG = 2; // Average 16 samples
AdcRegs.ADCAVGCTRL.bit.AVG0_EN = 1;
AdcRegs.ADCAVGCTRL.bit.AVG1_CONFIG = 2; // Average 16 samples
AdcRegs.ADCAVGCTRL.bit.AVG1_EN = 1;
AdcRegs.ADCAVGCTRL.bit.AVG2_CONFIG = 2; // Average 16 samples
AdcRegs.ADCAVGCTRL.bit.AVG2_EN = 1;
AdcRegs.ADCAVGCTRL.bit.AVG3_CONFIG = 2; // Average 16 samples
AdcRegs.ADCAVGCTRL.bit.AVG3_EN = 1;
AdcRegs.ADCAVGCTRL.bit.AVG4_CONFIG = 2; // Average 16 samples
AdcRegs.ADCAVGCTRL.bit.AVG4_EN = 1;
AdcRegs.ADCAVGCTRL.bit.AVG5_CONFIG = 2; // Average 16 samples
AdcRegs.ADCAVGCTRL.bit.AVG5_EN = 1;
}
The function poll_adc(); is reading the measurement results after it verifies that the conversion of last
sequence is concluded. The function also starts a new sequence of measurements that can be read when
the function is called next time.
312
ADC12 Overview
Buffer Registers
RESULT-00
RESULT-01
RESULT-02
RESULT-03
RESULT-04
RESULT-05
RESULT-06
RESULT-07
RESULT-08
RESULT-09
RESULT-10
RESULT-11
RESULT-12
RESULT-13
RESULT-14
RESULT-15
// A total of 7 conversions
// Vout-AD03
// Iout-AD02
// Ipri-AD04
// Ishare-AD05
// Vin voltage sensing
// Copper-Temp-AD12
// Ext-Temp-AD08
// Module0 averaging enabled
// Module1 averaging enabled
// Module2 averaging enabled
// Module3 averaging enabled
// Module4 averaging enabled
// Module5 averaging enabled
Copyright © 2016, Texas Instruments Incorporated
ADC Conversion Result
ADC-09
ADC-10
ADC-02
ADC-02
ADC-02
ADC-04
ADC-04
ADC-04
ADC-12
ADC-14
X
X
X
X
X
X
SNIU028A – February 2016 – Revised April 2016
Submit Documentation Feedback
www.ti.com

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents