1.. _mcux_lpcmp:
2
3NXP MCUX Low-power Analog Comparator (LPCMP)
4############################################
5
6Overview
7********
8
9This sample show how to use the NXP MCUX Analog Comparator (LPCMP) driver.
10
11In this application, the negative input port of the LPCMP is set to 7 which
12means the input voltage comes from the LPCMP internal DAC, the reference
13voltage of the DAC is set to 0 (for the specific chip, the user needs to
14check the reference manual to confirm where this reference voltage comes
15from), the output voltage of the DAC is equal to (VREF/256)*(data+1), where
16data is set through the attribute ``SENSOR_ATTR_MCUX_LPCMP_DAC_OUTPUT_VOLTAGE``.
17The positive input port is set to 0, the user needs to check the reference
18manual and board schematic to confirm which specific port is used and can
19connect an external voltage to that port and change the input voltage to
20see the output change of the LPCMP.
21
22The output value of the LPCMP is reported on the console.
23
24Building and Running
25********************
26
27Building and Running for NXP FRDM-MCXN947
28=========================================
29Build the application for the :ref:`frdm_mcxn947` board, and adjust the
30LPCMP positive input port voltage by changing the voltage input to J2-17.
31
32.. zephyr-app-commands::
33   :zephyr-app: samples/sensor/mcux_lpcmp
34   :board: frdm_mcxn947//cpu0
35   :goals: build flash
36   :compact:
37