MCUXpresso SDK Documentation

lpcmp_round_robin

lpcmp_round_robin#

Overview#

The LPCMP round robin example is a simple demonstration program that uses the LPCMP driver to help users get started quickly. In this example, users need to specify which port and channel to fix, and which channels to select as checker channels. Before doing the comparison, it is necessary to preset the comparison result of each checker channel with the fixed channel. If any results of the comparator are different from the preset value, an interrupt will be triggered, and the information of the triggered channel will be printed on the terminal after changing the input voltage of checker channels.

Supported Boards#

FRDM-MCXA153
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA153 board

  • Personal Computer

Board settings
Pin Name    Board Location     checker channel number       pre-set value           trigger        
P2_2            J2-9                channel 0                    1              input > DAC output
P1_3            J6-3                channel 1                    0              input < DAC output
P1_4            J1-2                channel 2                    1              input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 0(CMP0_IN0, P2_2, J2-9), channel 1(CMP0_IN1, P1_3, J6-3) and channel 2(CMP0_IN2, P1_4, J1-2), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x05U.

Set the input voltage of channel 0, channel 1 and channel 2 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!

FRDM-MCXA156
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA156 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger        
CMP0_IN0/P2_2     J2-9         channel 0              1           input > DAC output
CMP0_IN1/P1_3     J6-3         channel 1              0           input < DAC output
CMP0_IN2/P1_4     J2-1         channel 2              1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 0(CMP0_IN0, P2_2, J2-9), channel 1(CMP0_IN1, P1_3, J6-3) and channel 2(CMP0_IN2, P1_4, J2-1), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x05U.

Set the input voltage of channel 0, channel 1 and channel 2 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!

FRDM-MCXA346
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA346 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger        
CMP0_IN1/P1_3     J2-17        channel 0              1           input > DAC output
CMP0_IN2/P1_4     J2-7         channel 1              0           input < DAC output
CMP0_IN3/P1_0     J4-10        channel 2              1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 1(CMP0_IN1, P1_3, J2-17), channel 2(CMP0_IN2, P1_4, J2-7) and channel 3(CMP0_IN3, P1_0, J4-10), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x0AU.

Set the input voltage of channel 1, channel 2 and channel 3 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!
channel 3 comparison result is different from preset value!

FRDM-MCXN947
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXN947 Board

  • Personal Computer

Board settings
Pin Name    Board Location     checker channel number       pre-set value            trigger        
P1_0            J2-17                channel 0                    0              input < DAC output
P4_2            J1-4                 channel 4                    1              input > DAC output
P4_3            J1-2                 channel 5                    0              input < DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 0(CMP0_IN0, P1_0, J2-17), channel 4(CMP0_IN1, P4_2, J1-4) and channel 5(CMP0_IN2, P4_3, J1-2), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x10U.

Set the input voltage of channel 0, channel 4 and channel 5 to be less than, greater than and less than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 4 comparison result is different from preset value!
channel 5 comparison result is different from preset value!

FRDM-MCXN947T
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXN947T Board

  • Personal Computer

Board settings
Pin Name    Board Location     checker channel number       pre-set value            trigger        
P1_0            J2-17                channel 0                    0              input < DAC output
P4_2            J1-4                 channel 4                    1              input > DAC output
P4_3            J1-2                 channel 5                    0              input < DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 0(CMP0_IN0, P1_0, J2-17), channel 4(CMP0_IN1, P4_2, J1-4) and channel 5(CMP0_IN2, P4_3, J1-2), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x10U.

Set the input voltage of channel 0, channel 4 and channel 5 to be less than, greater than and less than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 4 comparison result is different from preset value!
channel 5 comparison result is different from preset value!

MCX-N5XX-EVK
Hardware requirements
  • Mini/micro USB cable

  • MCX-N5XX-EVK Board

  • Personal Computer

Board settings
Pin Name    Board Location     checker channel number       pre-set value            trigger        
P1_0            J2-17                channel 0                    0              input < DAC output
P4_2            J1-4                 channel 4                    1              input > DAC output
P4_3            J1-2                 channel 5                    0              input < DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 0(CMP0_IN0, P1_0, J2-17), channel 4(CMP0_IN1, P4_2, J1-4) and channel 5(CMP0_IN2, P4_3, J1-2), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x10U.

Set the input voltage of channel 0, channel 4 and channel 5 to be less than, greater than and less than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 4 comparison result is different from preset value!
channel 5 comparison result is different from preset value!

MCX-N9XX-EVK
Hardware requirements
  • Mini/micro USB cable

  • MCX-N9XX-EVK Board

  • Personal Computer

Board settings
Pin Name    Board Location     checker channel number       pre-set value            trigger        
P1_0            J2-17                channel 0                    0              input < DAC output
P4_2            J1-4                 channel 4                    1              input > DAC output
P4_3            J1-2                 channel 5                    0              input < DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 0(CMP0_IN0, P1_0, J2-17), channel 4(CMP0_IN1, P4_2, J1-4) and channel 5(CMP0_IN2, P4_3, J1-2), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x10U.

Set the input voltage of channel 0, channel 4 and channel 5 to be less than, greater than and less than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 4 comparison result is different from preset value!
channel 5 comparison result is different from preset value!

FRDM-MCXE31B
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXE31B board

  • Personal Computer

Board settings
Pin Name    Board Location     checker channel number       pre-set value            trigger        
PTA0            J9-3                channel 0                    0              input < DAC output
PTA1            J9-5                channel 1                    1              input > DAC output
PTA2            J2-9                channel 2                    0              input < DAC output

This example uses LPCMP1 instance, the fixed port is plusMuxPort, the fixed channel is internal DAC module, and the checker channels are channel 0(CMP1_IN0, PTA0, J9-3), channel 4(CMP1_IN1, PTA1, J9-5) and channel 5(CMP1_IN2, PTA2, J2-9) in miusMuxPort.

Set the input voltage of channel 0, channel 4 and channel 5 to be less than, greater than and less than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the MCU-Link terminal: 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. The checker channel’s pre-set value is 0x2U.

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!
FRDM-MCXE32B
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXE32B board

  • Personal Computer

Board settings
Pin Name    Board Location     checker channel number       pre-set value            trigger        
PTA0            J9-3                channel 0                    0              input < DAC output
PTA1            J9-5                channel 1                    1              input > DAC output
PTA2            J2-9                channel 2                    0              input < DAC output

This example uses LPCMP1 instance, the fixed port is plusMuxPort, the fixed channel is internal DAC module, and the checker channels are channel 0(CMP1_IN0, PTA0, J9-3), channel 1(CMP1_IN1, PTA1, J9-5) and channel 2(CMP1_IN2, PTA2, J2-9) in miusMuxPort.

Set the input voltage of channel 0, channel 1 and channel 2 to be less than, greater than and less than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the MCU-Link terminal: 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. The checker channel’s pre-set value is 0x2U.

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!
FRDM-MCXA174
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA174 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger        
CMP0_IN1/P1_3     J2-17        channel 0              1           input > DAC output
CMP0_IN2/P1_4     J2-7         channel 1              0           input < DAC output
CMP0_IN3/P1_0     J4-10        channel 2              1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 1(CMP0_IN1, P1_3, J2-17), channel 2(CMP0_IN2, P1_4, J2-7) and channel 3(CMP0_IN3, P1_0, J4-10), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x0AU.

Set the input voltage of channel 1, channel 2 and channel 3 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!
channel 3 comparison result is different from preset value!

FRDM-MCXA344
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA344 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger        
CMP0_IN1/P1_3     J2-17        channel 0              1           input > DAC output
CMP0_IN2/P1_4     J2-7         channel 1              0           input < DAC output
CMP0_IN3/P1_0     J4-10        channel 2              1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 1(CMP0_IN1, P1_3, J2-17), channel 2(CMP0_IN2, P1_4, J2-7) and channel 3(CMP0_IN3, P1_0, J4-10), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x0AU.

Set the input voltage of channel 1, channel 2 and channel 3 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!
channel 3 comparison result is different from preset value!

FRDM-MCXA266
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA266 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger        
CMP0_IN1/P1_3     J2-17        channel 0              1           input > DAC output
CMP0_IN2/P1_4     J2-7         channel 1              0           input < DAC output
CMP0_IN3/P1_0     J4-10        channel 2              1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 1(CMP0_IN1, P1_3, J2-17), channel 2(CMP0_IN2, P1_4, J2-7) and channel 3(CMP0_IN3, P1_0, J4-10), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x0AU.

Set the input voltage of channel 1, channel 2 and channel 3 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!
channel 3 comparison result is different from preset value!

FRDM-MCXA366
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA366 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger        
CMP0_IN1/P1_3     J2-17        channel 0              1           input > DAC output
CMP0_IN2/P1_4     J2-7         channel 1              0           input < DAC output
CMP0_IN3/P1_0     J4-10        channel 2              1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 1(CMP0_IN1, P1_3, J2-17), channel 2(CMP0_IN2, P1_4, J2-7) and channel 3(CMP0_IN3, P1_0, J4-10), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x0AU.

Set the input voltage of channel 1, channel 2 and channel 3 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 1 comparison result is different from preset value!
channel 2 comparison result is different from preset value!
channel 3 comparison result is different from preset value!

FRDM-MCXA577
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA577 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger
CMP0_IN2/P1_4     R132         channel 2             1           input > DAC output
CMP0_IN4/P2_2     J8-23        channel 4             0           input < DAC output
CMP0_IN5/P2_3     J9-14        channel 5             1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 2(CMP0_IN2, P1_4, R132), channel 4(CMP0_IN4, P2_2, J8-23) and channel 5(CMP0_IN5, P2_3, J9-14), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x0AU.

Set the input voltage of channel 0, channel 1 and channel 2 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 2 comparison result is different from preset value!
channel 4 comparison result is different from preset value!
channel 5 comparison result is different from preset value!

FRDM-MCXC162
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXC162 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger        
CMP0_IN0/P2_2     J2-9         channel 0              1           input > DAC output
CMP0_IN1/P1_3     J2-3         channel 1              0           input < DAC output
CMP0_IN3/P1_0     J2-5         channel 3              1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 0(CMP0_IN1, P2_2, J2-19), channel 1(CMP0_IN1, P1_3, J2-3) and channel 3(CMP0_IN3, P1_0, J2-5), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x0AU.

Set the input voltage of channel 1, channel 2 and channel 3 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 0 comparison result is different from preset value!
channel 1 comparison result is different from preset value!
channel 3 comparison result is different from preset value!

FRDM-MCXA287
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA287 board

  • Personal Computer

Board settings
Pin Name  Board Location  checker channel number   pre-set value      trigger
CMP0_IN2/P1_4     J9-24        channel 2             1           input > DAC output
CMP0_IN4/P2_2     J8-23        channel 4             0           input < DAC output
CMP0_IN5/P2_3     J9-14        channel 5             1           input > DAC output

This example uses LPCMP0 instance, the fixed port is plusMuxPort, the fixed channel is channel 7(Internal DAC module), and the checker channels are channel 2(CMP0_IN2, P1_4, J9-24), channel 4(CMP0_IN4, P2_2, J8-23) and channel 5(CMP0_IN5, P2_3, J9-14), in miusMuxPort. The LPCMP’s internal DAC module output voltage signal(half of VREFI), the channel’s pre-set value is 0x0AU.

Set the input voltage of channel 0, channel 1 and channel 2 to be greater than, less than and greater than the output voltage of the DAC respectively. The comparison results of the three channels are different from the pre-set value. So the interrupt occurred and the terminal will print corresponding channel changed information.

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

When the demo runs successfully, following information can be seen on the OpenSDA terminal:

LPCMP RoundRobin Example.
channel 2 comparison result is different from preset value!
channel 4 comparison result is different from preset value!
channel 5 comparison result is different from preset value!