English
Language : 

LM3S812_16 Datasheet, PDF (486/590 Pages) Texas Instruments – Stellaris LM3S812 Microcontroller
Analog Comparator
Table 14-3. Internal Reference Voltage and ACREFCTL Field Values (continued)
ACREFCTL Register
EN Bit Value RNG Bit Value
RNG=0
Output Reference Voltage Based on VREF Field Value
Total resistance in ladder is 31 R.
EN=1
RNG=1
The range of internal reference in this mode is 0.85-2.448 V.
Total resistance in ladder is 23 R.
14.4
14.5
The range of internal reference for this mode is 0-2.152 V.
Initialization and Configuration
The following example shows how to configure an analog comparator to read back its output value
from an internal register.
1. Enable the analog comparator 0 clock by writing a value of 0x0010.0000 to the RCGC1 register
in the System Control module.
2. In the GPIO module, enable the GPIO port/pin associated with C0- as a GPIO input.
3. Configure the internal voltage reference to 1.65 V by writing the ACREFCTL register with the
value 0x0000.030C.
4. Configure comparator 0 to use the internal voltage reference and to not invert the output by
writing the ACCTL0 register with the value of 0x0000.040C.
5. Delay for some time.
6. Read the comparator output value by reading the ACSTAT0 register’s OVAL value.
Change the level of the signal input on C0- to see the OVAL value change.
Register Map
Table 14-4 on page 487 lists the comparator registers. The offset listed is a hexadecimal increment
to the register’s address, relative to the Analog Comparator base address of 0x4003.C000.
Note that the analog comparator module clock must be enabled before the registers can be
programmed (see page 197). There must be a delay of 3 system clocks after the ADC module clock
is enabled before any ADC module registers are accessed.
486
July 14, 2014
Texas Instruments-Production Data