Analog
Comparator
Polarity Select
(ACOMP_x_POL)
Interrupt Enable
(ACOMP_x_INT_EN)
ACOMP_x
ACOMP_x_INT
DAC out or ADC pin in
(ACOMP_x_OUT_EN)
ADC0x pin
7 bit DAC
Source controlled by
(ACOMP_x_SEL)
Local DAC value
(ACOMP_x_THRESH)
Comparator Ramp
Filter 0
Filter 1
Filter 2
Analog Comparator Configuration
228
SNIU028A – February 2016 – Revised April 2016
Copyright © 2016, Texas Instruments Incorporated
Fault Mux
6.1
Analog Comparator Configuration
The analog comparators are controlled by the ACOMPCTRL0 to ACOMPCTRL3 registers.
shows how the control works:
Figure 6-2. UCD3138 Analog Comparator Control
All the names in parentheses on the drawing above are bitfield names in the ACOMPCTRL registers. The
Analog Comparators are sampled at the HFO rate (nominal 250 MHz). Any fault on the Analog
Comparators will be transmitted to the Fault Mux regardless of the DPWM timing.
6.1.1 ACOMP_EN
The first step in starting the analog comparators is to set the ACOMP_EN bit in ACOMPCTRL0.
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_EN = 1;
This bit enables all the analog comparators.
6.1.2 ACOMP_x_THRESH
For typical operation - detecting an overcurrent or over voltage fault - only the ACOMP_x_THRESH
register needs to be written. It is written with a value that corresponds to the fault level on the input pin.
FaultMuxRegs.ACOMPCTRL1.bit.ACOMP_C_THRESH = OVER_VOLTAGE_THRESH;
All the other registers are set to defaults which work for this application.
6.1.3 ACOMP_x_POL
To detect a fault caused by a voltage going below a threshold, rather than above, clear the
ACOMP_x_POL bit. A zero in this bit causes the ACOMP_x signal to go active when the ADC pin goes
below the comparator threshold.
6.1.4 ACOMP_x_INT_EN
The ACOMP_x_INT_EN bit, when set enables an interrupt from the Analog Comparator.
6.1.5 ACOMP_x_OUT_EN
The ACOMP_x_OUT_EN bit when set, puts the DAC value out on the ADC pin, which can be used as an
external reference. Consult the UCD3138 device datasheet for additional information. When this bit is
enabled, obviously the comparator output signals are not valid.
6.1.6 ACOMP_x_SEL
The comparator DAC can also be driven by other data – Filter outputs and a comparator ramp engine.
The ACOMP_x_SEL register selects which of these sources is used.