Analog Subsystem Software
946
SPRUHE8E – October 2012 – Revised November 2019
Copyright © 2012–2019, Texas Instruments Incorporated
Analog Subsystem
ADC1_ENABLE
0x0008
Mask to Enable ADC1
ADC2_ENABLE
0x8000
Mask to Enable ADC2
COMP1_ENABLE
0x0001
Mask to Enable COMP1
COMP2_ENABLE
0x0002
Mask to Enable COMP2
COMP3_ENABLE
0x0004
Mask to Enable COMP3
COMP4_ENABLE
0x0008
Mask to Enable COMP4
COMP5_ENABLE
0x0010
Mask to Enable COMP5
COMP6_ENABLE
0x0020
Mask to Enable COMP6
ANALOGCONFIG2ALL
0x803F
Mask to Enable ADC2, COMP1,2,3,4,5,6
NOTE:
Multiple parameters can be used by ORing them together in the function call.
This function will return 0xFFFF while trying to enable the clocks, and 0 when the function completes
successfully. This function must be run in a while loop. See example software in
.
10.5.3.2 AnalogClockDisable Function
The AnalogClockDisable function disables the clock to each Analog Subsystem peripheral. This function
requires two input parameters.
Valid #define values for the AnalogConfigReg parameter are located in the sysctl.h file.
AnalogConfig1
1
Choose Analog Config Register 1 (used to enable ADC1)
AnalogConfig2
2
Choose Analog Config Register 2 (used to enable ADC2, COMP1,2,3,4,5,6)
Valid #define values for the AnalogClockMask parameter are located in the sysctl.h file
ADC1_ENABLE
0x0008
Mask to Enable ADC1
ADC2_ENABLE
0x8000
Mask to Enable ADC2
COMP1_ENABLE
0x0001
Mask to Enable COMP1
COMP2_ENABLE
0x0002
Mask to Enable COMP2
COMP3_ENABLE
0x0004
Mask to Enable COMP3
COMP4_ENABLE
0x0008
Mask to Enable COMP4
COMP5_ENABLE
0x0010
Mask to Enable COMP5
COMP6_ENABLE
0x0020
Mask to Enable COMP6
ANALOGCONFIG2ALL
0x803F
Mask to Enable ADC2, COMP1,2,3,4,5,6
NOTE:
Multiple parameters can be used by ORing them together in the function call.
This function will return 0xFFFF while trying to disable the clocks, and 0 when the function completes
successfully. This function must be run in a while loop. See example software in
.
10.5.3.3 ReadAnalogClockStatus
The ReadAnalogClockStatus function is used to read the status of the Analog Subsystem Configuration 1
and 2 registers. These are the registers written to using the AnalogClockEnable and AnalogClockDisable
functions.
Valid #define values for the AnalogConfigReg parameter are located in the sysctl.h file.
AnalogConfig1
1
Choose Analog Config Register 1 (used to read ADC1 clock status)
AnalogConfig2
2
Choose Analog Config Register 2 (used to read ADC2, COMP1,2,3,4,5,6 clock
status)
This function will return the status of the Analog Config Register 1 or 2 depending on the function
parameter used.
10.5.4 M3 Analog Subsystem Software Example
Below is a software example of how to use all the M3 Analog Subsystem functions in an application. The
code enables ADC1, ADC2, COMP1, and COMP4 analog peripherals. The example also reads the status
of the Analog Subsystem Config Registers to check for correctness.