MCUXpresso SDK Documentation

lpcmp_polling

lpcmp_polling#

Overview#

The LPCMP polling Example shows the simplest way to use LPCMP driver and help user with a quick start.

In this example, user should indicate an input channel to capture a voltage signal (can be controlled by user) as the LPCMP’s positive channel input. On the negative side, the internal DAC is used to generate the fixed voltage about half value of reference voltage.

When running the project, change the input voltage of user-defined channel, then the comparator’s output would change between logic one and zero when the user’s voltage crosses the internal DAC’s value. The endless loop in main() function would detect the logic value of comparator’s output, and change the LED. The LED would be turned on when the compare output is logic one, or turned off when zero.

Supported Boards#

FRDM-K32L3A6
Hardware requirements
  • Mini/micro USB cable

  • FRDM-K32L3A6 board

  • Personal Computer

Board settings

This example project uses LPCMP instance 0(M4) or instance 1(M0) to compare the voltage signal input from channel 2(PTC9) with the voltage signal(half of VDDIO) output by LPCMP’s internal DAC and output different result. LED1 will turn ON/OFF corresponding to different result. So the voltage signal input from PTC9 should be changed to observe the dynamical LED state.

  • Input signal to J2-18

Prepare the Demo
  1. Connect a USB cable between the host PC and the OpenSDA USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the example.

Running the demo

The log below shows in the terminal window:

LPCMP polling Example.
FRDM-MCXA153
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA153 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
VREFI/P2_7         J3-1           VDD         JP8-2
CMP0_IN0/P2_2      J2-9           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN0(P2_2, J2-9) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J3-1(P2_7,VREFI) to JP8-2(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of J2-9(P2_2, CMP0_IN0) will toggle the RED LED.

Prepare the Demo
  1. Connect a Type-C USB cable between the host PC and the MCU-Link port(J15) on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXA156
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA156 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN0/P2_2      J2-9           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN0(P2_2, J2-9) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J3-1(P2_7,VREFI) to JP8-2(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of J2-9(P2_2, CMP0_IN0) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXA346
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA346 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN1/P1_3      J2-17           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN1(P1_3, J2-17) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J2-1(P2_7,VREFI) to J13-1(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of J2-17(P1_3, CMP0_IN1) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXN236
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXN236 board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(P1_0) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from P1_0 corresponding J7-3 on FRDM board should be changed to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect the type-c and mini USB cable between the PC host and the USB ports on the board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXN947
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXN947 Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(P1_0) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from P1_0 corresponding J2-17 on EVK board should be changed to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect the type-c and mini USB cable between the PC host and the USB ports on the board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
FRDM-MCXN947T
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXN947T Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(P1_0) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from P1_0 corresponding J2-17 on EVK board should be changed to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect the type-c and mini USB cable between the PC host and the USB ports on the board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
FRDM-MCXW71
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXW71 Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(PTA4) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. When the demo runs successfully, then the voltage signal input from PTA4 corresponding J4-3 should be used to observe the dynamical IO state. You will see the green led toggle with the voltage change.

Prepare the Demo
  1. Connect the micro and mini USB cable between the PC host and the USB ports on the board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
MCX-W71-EVK
Hardware requirements
  • Type-C USB cable

  • MCX-W71-EVK Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(PTA4) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. When the demo runs successfully, then the voltage signal input from PTA4 corresponding J4-5 should be used to observe the dynamical IO state. You will see the green led toggle with the voltage change.

Prepare the Demo
  1. Connect a USB cable between the host PC and the EVK board J14.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
KW45B41Z-EVK
Hardware requirements
  • Mini/micro USB cable

  • KW45B41Z-EVK Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(PTA4) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. When the demo runs successfully, you will detect voltage toggle on J4.P31 of MB board. The voltage signal input from PTA4 corresponding J4-29 on mather board should be changed to observe the dynamical IO state. If the EVK board is used then the voltage signal input from PTA4 corresponding J4-4 should be used to observe the dynamical IO state. You will see the green led toggle with the voltage change.

Prepare the Demo
  1. Connect the micro and mini USB cable between the PC host and the USB ports on the board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
KW47-EVK
Hardware requirements
  • Type-C USB cable

  • KW47-EVK Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(PTA4) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from PTA4 corresponding J4-5 should be used to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect a USB cable between the host PC and the EVK board J14.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
MCX-N5XX-EVK
Hardware requirements
  • Mini/micro USB cable

  • MCX-N5XX-EVK Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(P1_0) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from P1_0 corresponding J2-17 on EVK board should be changed to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect the micro and mini USB cable between the PC host and the USB ports on the board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
MCX-N9XX-EVK
Hardware requirements
  • Mini/micro USB cable

  • MCX-N9XX-EVK Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(P1_0) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from P1_0 corresponding J2-17 on EVK board should be changed to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect the micro and mini USB cable between the PC host and the USB ports on the board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
MCX-W72-EVK
Hardware requirements
  • Type-C USB cable

  • MCX-W72-EVK Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(PTA4) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from PTA4 corresponding J4-5 should be used to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect a USB cable between the host PC and the EVK board J14.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
FRDM-MCXE31B
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXE31B board

  • Personal Computer

Board settings

This example project uses LPCMP1 to compare the voltage signal input from channel 0(PTA0) with the voltage signal output by LPCMP’s internal DAC.

The voltage signal input from PTA0 corresponding J9-3 on FRDM-MCXE31B board should be changed to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect a type-c USB cable between the host PC and the MCU-Link USB port (J13) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed. The DAC reference comes from 1.2 V PMC bandgap reference in this project, note that the 1.2 V internal reference voltage is not available in Standby mode. When the voltage applied on J9-3 in higher than 0.6v, the LED will turn on. When the voltage applied on J9-3 in lower than 0.6v, the LED will turn off.

LPCMP polling Example.
FRDM-MCXE32B
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXE32B board

  • Personal Computer

Board settings

This example project uses LPCMP1 to compare the voltage signal input from channel 0(PTA0) with the voltage signal output by LPCMP’s internal DAC.

The voltage signal input from PTA0 corresponding J9-3 on FRDM-MCXE32B board should be changed to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect a type-c USB cable between the host PC and the MCU-Link USB port (J13) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed. The DAC reference comes from 1.2 V PMC bandgap reference in this project, note that the 1.2 V internal reference voltage is not available in Standby mode. When the voltage applied on J9-3 in higher than 0.6v, the LED will turn on. When the voltage applied on J9-3 in lower than 0.6v, the LED will turn off.

LPCMP polling Example.
FRDM-MCXA174
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA174 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN1/P1_3      J2-17           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN1(P1_3, J2-17) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J2-1(P2_7,VREFI) to J13-1(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of J2-17(P1_3, CMP0_IN1) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXA344
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA344 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN1/P1_3      J2-17           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN1(P1_3, J2-17) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J2-1(P2_7,VREFI) to J13-1(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of J2-17(P1_3, CMP0_IN1) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
KW47-LOC
Hardware requirements
  • Type-C USB cable

  • KW47-LOC Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 2(PTA21) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from PTA21 corresponding J1-1 should be used to observe the dynamical IO state. You will see the blue led toggle with the voltage change.

Prepare the Demo
  1. Connect a USB cable between the host PC and the LOC board J3.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
MCXW72-LOC
Hardware requirements
  • Type-C USB cable

  • MCXW72-LOC Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 2(PTA21) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from PTA21 corresponding J1-1 should be used to observe the dynamical IO state. You will see the blue led toggle with the voltage change.

Prepare the Demo
  1. Connect a USB cable between the host PC and the LOC board J3.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
FRDM-MCXA266
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA266 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN1/P1_3      J2-17           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN1(P1_3, J2-17) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J2-1(P2_7,VREFI) to J13-1(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of J2-17(P1_3, CMP0_IN1) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXA366
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA366 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN1/P1_3      J2-17           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN1(P1_3, J2-17) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J2-1(P2_7,VREFI) to J13-1(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of J2-17(P1_3, CMP0_IN1) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXW72
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXW72 Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(PTA4) with the voltage signal(half of VREF_OUT) output by LPCMP’s internal DAC. The voltage signal input from PTA4 corresponding J4-3 should be used to observe the dynamical IO state. You will see the green led toggle with the voltage change.

Prepare the Demo
  1. Connect a USB cable between the host PC and the FRDM board J10.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
FRDM-MCXA577
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA577 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN2/P1_4      R132           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN2(P1_4, R132) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J8-28(P2_7,VREFI) to J8-1(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of CMP0_IN2(P1_4, R132) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXC162
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXC162 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN1/P1_3      J6-1           VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN1(P1_3, J6-1) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Change the IO state of J6-1(P1_3, CMP0_IN1) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-KW43
Hardware requirements
  • Type-C USB cable

  • FRDM-KW43 Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(PTA5) with the voltage signal(half of VREFH) output by LPCMP’s internal DAC. The voltage signal input from PTA5 corresponding J24-3 should be used to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect a USB cable between the host PC and the FRDM board J28.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
FRDM-MCXW70
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXW70 Board

  • Personal Computer

Board settings

This example project uses LPCMP0 to compare the voltage signal input from channel 0(PTA5) with the voltage signal(half of VREFH) output by LPCMP’s internal DAC. The voltage signal input from PTA5 corresponding J24-3 should be used to observe the dynamical IO state. You will see the red led toggle with the voltage change.

Prepare the Demo
  1. Connect a USB cable between the host PC and the FRDM board J28.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP polling Example.
FRDM-MCXA287
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA287 board

  • Personal Computer

Board settings
Pin Name       Board Location     Pin Name    Board Location
CMP0_IN2/P1_4      J9-24          VDD or GND

This example project uses LPCMP0 to compare the voltage signal input from CMP0_IN2(P1_4, R132) with the voltage signal(half of VREFI) output by LPCMP’s internal DAC. Connect J8-28(P2_7,VREFI) to J8-1(VDD), this will set the VREFI to VDD(The VREFI is used as LPCMP reference voltage). Change the IO state of CMP0_IN2(P1_4, J9-24) will toggle the RED LED.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal on PC for the serial device with these settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.
FRDM-MCXL255
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXL255 board

  • Personal Computer

Board settings
        Pin Name            Board Location      Pin Name        Board Location
CM33    CMP0_IN3/P2_15      J6-2 (Mikro bus) >  VDD or GND      J6_7 or J6_8
CM0+    AON_CMP0_IN3/P0_4   J8_21(Sensor p.) >  VDD or GND      J8_2 or J8_1

This example project uses LPCMP0 to compare the voltage signal input from input pin with the voltage signal(half of VDD) output by LPCMP’s internal DAC.

Make sure you have solder bridges SJ1 and SJ2 set to

  • 2-1 for the main core (cm33)

  • 2-3 for AON core (cm0+)

Make sure you have solder bridges SJ28 set to 2-3 for CM0+ core.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port (J16) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

On the main core blue led will shine when input pin is is high. On AON (cm0+ core) as there is no led, H or L letters will be printed into console instead.

The following lines are printed to the serial terminal when the demo program is executed.

LPCMP Polling Example.