Figure 11-3 shows the block diagram of the comparator reference voltage generator. The
comparator reference voltage generator consists of a 8-bit DAC along with some configuration options. The REFSRC bits in COMPx.CTL2 register are used to select the reference source for the comparator.
- When REFSRC = 0, the reference voltage generator is disabled and the reference voltage generator cannot be used for comparator operation.
- When REFSRC = 1, the analog supply VDDA is selected as the reference input for the DAC and the DAC output is used as reference voltage for the comparator.
- When REFSRC = 2, the VREF from internal reference module output is selected as the reference input for the DAC and the DAC output is used as reference voltage for the
comparator.
- When REFSRC = 3, the VREF from internal reference module output is used directly as reference voltage for the comparator and the DAC is switched off.
The reference voltage generator output can be applied to either the positive terminal or negative terminal of the comparator using the REFSEL bit COMPx.CTL2 register. If external signals are
applied to both comparator input terminals, turn off the internal reference voltage generator to reduce current consumption.
When the reference voltage generator output is applied on a comparator terminal using REFSEL bit COMPx.CTL2 register and the comparator channel (from device pins or from internal analog modules)
is also selected on the same terminal using IPSEL/IPEN or IMSEL/IMEN bits in COMPx.CTL0 register then the comparator channel selection takes precedence.
DAC8 output is also connected to the internal analog OPA module through OPAx (see
Figure 12-1).
Integrated 8-bit DAC
The 8-bit DAC input code can be provided through DACCODE0 or DACCODE1 bits in COMPx.CTL3 register. The DACCTL bit in COMPx.CTL2 register determines if the comparator output or a software control
bit DACSW in COMPx.CTL2 register selects DACCODE0 or DACCODE1 bits as input to DAC.
- When DACCTL is 0 the comparator output value selects DACCODE0 or DACCODE1. If the comparator output value is 0, DACCODE0 will be the input to DAC. And DACCODE1 will be the input to DAC if
the comparator output value is 1.
- When DACCTL is 1 the DACSW bit value that is programmed by software selects DACCODE0 or DACCODE1. If DACSW is 0, DACCODE0 will be the input to DAC. And DACCODE1 will be the input to DAC if
DACSW is 1. With this provision it is possible to generate desired hysteresis levels for the comparator without using external components.
- The REFMODE bit in COMPx.CTL2 register determines if the comparator requests for internal VREF operation in fast or ultra-low-power and also the mode of operation of the 8-bit DAC. When
REFMODE bit is 0, the internal VREF is requested for operation in fast mode and the 8-bit DAC in comparator is configured in fast mode as well. When REFMODE bit is 1, the internal VREF is requested for operation in ultra-low-power and
the 8-bit DAC in comparator in comparator is configured in ultra-low-power. Operation in fast mode offers higher accuracy but consumes higher current while the ultra-low-power operation consumes lower current but with relaxed reference
voltage accuracy. Refer to comparator electrical specifications in device-specific data sheet for details.