1.. zephyr:code-sample:: mcux_lpcmp
2   :name: NXP MCUX Low-power Analog Comparator (LPCMP)
3   :relevant-api: sensor_interface
4
5   Get analog comparator data from an NXP MCUX Low-power Analog Comparator (LPCMP).
6
7Overview
8********
9
10This sample show how to use the NXP MCUX Low-power Analog Comparator (LPCMP) driver.
11
12In this application, the negative input port of the LPCMP is set to 7 which
13means the input voltage comes from the LPCMP internal DAC, the reference
14voltage of the DAC is set to 0 (for the specific chip, the user needs to
15check the reference manual to confirm where this reference voltage comes
16from), the output voltage of the DAC is equal to (VREF/256)*(data+1), where
17data is set through the attribute ``SENSOR_ATTR_MCUX_LPCMP_DAC_OUTPUT_VOLTAGE``.
18The positive input port is set to 0, the user needs to check the reference
19manual and board schematic to confirm which specific port is used and can
20connect an external voltage to that port and change the input voltage to
21see the output change of the LPCMP.
22
23The output value of the LPCMP is reported on the console.
24
25Building and Running
26********************
27
28Building and Running for NXP FRDM-MCXN947
29=========================================
30Build the application for the :zephyr:board:`frdm_mcxn947` board, and adjust the
31LPCMP positive input port voltage by changing the voltage input to J2-17.
32
33.. zephyr-app-commands::
34   :zephyr-app: samples/sensor/mcux_lpcmp
35   :board: frdm_mcxn947//cpu0
36   :goals: build flash
37   :compact:
38
39Building and Running for NXP FRDM-MCXN236
40=========================================
41Build the application for the :zephyr:board:`frdm_mcxn236` board, and adjust the
42LPCMP positive input port voltage by changing the voltage input to J2-8.
43
44.. zephyr-app-commands::
45   :zephyr-app: samples/sensor/mcux_lpcmp
46   :board: frdm_mcxn236
47   :goals: build flash
48   :compact:
49
50Building and Running for NXP FRDM-MCXA156
51=========================================
52Build the application for the :zephyr:board:`frdm_mcxa156` board, and adjust the
53LPCMP positive input port voltage by changing the voltage input to J2-9.
54
55.. zephyr-app-commands::
56   :zephyr-app: samples/sensor/mcux_lpcmp
57   :board: frdm_mcxa156
58   :goals: build flash
59   :compact:
60