MCUXpresso SDK Documentation

acmp_interrupt_print

acmp_interrupt_print#

Overview#

The ACMP Interrupt project is a simple demonstration program that uses the SDK software. It compares the selected analog input with ACMP internal DAC output continuously and print information corresponding to different comparison result in terminal. The purpose of this demo is to show how to use the ACMP driver in SDK software by interrupt way. The ACMP can be configured based on default configuration returned by the API ACMP_GetDefaultConfig(). The default configuration is: high speed is not enabled, invert output is not enabled, unfiltered output is not enabled, pin out is not enabled, offset level is level 0, hysteresis level is level 0.

Running the demo#

Before example running, please connect the analog input voltage to stable external voltage generator to avoid floating voltage and adjust external voltage generator to be higher than reference DAC output (half of referene voltage) to make the initial comparison result to be 0. Please note that the input voltage should range from 0 to 1.8V. When the demo runs successfully, following information can be seen on the terminal:

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output

Supported Boards#

EVK9-MIMX8ULP
Hardware requirements
  • Micro USB cable

  • MIMX8ULP-EVK/EVK9 board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings
  • This example project uses ACMP instance 0 to compare the voltage signal input from External Input4(J23-6) with the voltage signal(half of 1.8V) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result.

  • Please note that the input voltage should in the range of 0 to 1.8V.

  • Connect ACMP Input4(J23-6) to DC power supply.

Please note this application can’t support running with Linux BSP!

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW1 to power on the board.

  2. Connect a micro USB cable between the host PC and the J6 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

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

Running the demo

If the input voltage input is in the range of 0.9V to 1.8V, that means the analog input is higher than DAC output. If the input voltage input is in the range of 0V to 0.8V, that means the analog input is lower than DAC output.

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

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
MIMXRT1170-EVKB
Hardware requirements
  • Micro USB cable

  • MIMXRT1170-EVKB board

  • Personal Computer

Board settings

This example project uses ACMP instance 1 to compare the voltage signal input from External Input2(J25-13) with the voltage signal(half of VDDA_1P8_IN) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result. Please note that the input voltage should in the range of 0 to 1.8V. Connect ACMP External Input2(J25-13) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Please note this application can’t support running with Linux BSP!

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW5 to power on the board.

  2. Connect a micro USB cable between the host PC and the J11 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

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

Running the demo

If the input voltage input is in the range of 0.9V to 1.8V, that means the analog input is higher than DAC output. If the input voltage input is in the range of 0V to 0.9V, that means the analog input is lower than DAC output.

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

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
FRDM-IMXRT1152
Hardware requirements
  • Micro USB cable

  • FRDM-IMXRT1152 board

  • Personal Computer

Board settings

This example project uses ACMP instance 3 to compare the voltage signal input from External Input2(GPIO_AD_28,J11-12) with the voltage signal(half of VDDA_1P8_IN) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result. Please note that the input voltage should in the range of 0 to 1.8V. Connect ACMP External Input2(GPIO_AD_28, J11-12) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Please note this application can’t support running with Linux BSP!

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW5 to power on the board.

  2. Connect a micro USB cable between the host PC and the J11 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

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

Running the demo

If the input voltage input is in the range of 0.9V to 1.8V, that means the analog input is higher than DAC output. If the input voltage input is in the range of 0V to 0.9V, that means the analog input is lower than DAC output.

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

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
EVK-MCIMX7ULP
Hardware requirements
  • Micro USB cable

  • MCIMX7ULP-EVK board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings

This example project uses ACMP instance 1 to compare the voltage signal input from External Input6(TP27) with the voltage signal(half of VDDA) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result.

Connect ACMP External Input6(TP27) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Please note this application can’t support running with Linux BSP!

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW1 to power on the board.

  2. Connect a micro USB cable between the host PC and the J6 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

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

Running the demo

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

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
EVK-MIMX8ULP
Hardware requirements
  • Micro USB cable

  • MIMX8ULP-EVK/EVK9 board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings
  • This example project uses ACMP instance 0 to compare the voltage signal input from External Input4(J23-6) with the voltage signal(half of 1.8V) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result.

  • Please note that the input voltage should in the range of 0 to 1.8V.

  • Connect ACMP Input4(J23-6) to DC power supply.

Please note this application can’t support running with Linux BSP!

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW1 to power on the board.

  2. Connect a micro USB cable between the host PC and the J6 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

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

Running the demo

If the input voltage input is in the range of 0.9V to 1.8V, that means the analog input is higher than DAC output. If the input voltage input is in the range of 0V to 0.8V, that means the analog input is lower than DAC output.

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

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
MIMXRT1160-EVK
Hardware requirements
  • Micro USB cable

  • MIMXRT1160-EVK board

  • Personal Computer

Board settings

This example project uses ACMP instance 1 to compare the voltage signal input from External Input2(J25-13) with the voltage signal(half of VDDA_1P8_IN) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result. Please note that the input voltage should in the range of 0 to 1.8V. Connect ACMP External Input2(J25-13) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Please note this application can’t support running with Linux BSP!

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board, switch SW5 to power on the board.

  2. Connect a micro USB cable between the host PC and the J11 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

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

Running the demo

If the input voltage input is in the range of 0.9V to 1.8V, that means the analog input is higher than DAC output. If the input voltage input is in the range of 0V to 0.9V, that means the analog input is lower than DAC output.

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

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
MIMXRT1180-EVK
Hardware requirements
  • Micro USB cable

  • MIMXRT1180-EVK board

  • Personal Computer

Board settings

This example project uses ACMP instance 1 to compare the voltage signal input from External Input2(J45-13) with the voltage signal(half of VDDA_1P8_IN) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result. Please note that the input voltage should in the range of 0 to 1.8V. Connect ACMP External Input2(J45-13) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Please note this application can’t support running with Linux BSP!

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board and power on the board.

  2. Connect a micro USB cable between the host PC and the J53 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

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

Running the demo

If the input voltage input is in the range of 0.9V to 1.8V, that means the analog input is higher than DAC output. If the input voltage input is in the range of 0V to 0.9V, that means the analog input is lower than DAC output.

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

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
EVK-MIMXRT595
Hardware requirements
  • Micro USB cable

  • EVK-MIMXRT595 board

  • Personal Computer

Board settings

This example project uses ACMP to compare the voltage signal input from External Input1(J18-3) with the voltage signal(half of Vin1 form internal PMC) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result.

Connect ACMP External Input1(J18-3) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Prepare the Demo
  1. Connect a micro USB cable between the PC host and the CMSIS DAP USB port (J40) on the 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. 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 terminal:

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
EVK-MIMXRT685
Hardware requirements
  • Micro USB cable

  • EVK-MIMXRT685 board

  • Personal Computer

Board settings

This example project uses ACMP to compare the voltage signal input from External Input1(J1-9) with the voltage signal(half of Vin1 from internal PMC) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result.

Connect ACMP External Input1(J1-9) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Prepare the Demo
  1. Connect a micro USB cable between the PC host and the CMSIS DAP USB port (J5) on the 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. 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 terminal:

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
MIMXRT685-AUD-EVK
Hardware requirements
  • Micro USB cable

  • MIMXRT685-AUD-EVK board

  • Personal Computer

Board settings

This example project uses ACMP to compare the voltage signal input from External Input1(J48-22) with the voltage signal(half of Vin2 from internal PMC) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result.

Connect ACMP External Input1(J48-22) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Prepare the Demo
  1. Connect a micro USB cable between the PC host and the CMSIS DAP USB port (J5) on the 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. 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 terminal:

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output
MIMXRT700-EVK
Hardware requirements
  • Micro USB cable

  • MIMXRT700-EVK board

  • Personal Computer

Board settings

This example project uses the ACMP to compare with the voltage signal from external input(PIO10_8) J3-28 or J7-9. Please keep the external input voltage signal stable to avoid floating voltage. The ACMP positive input voltage is from the internal DAC output, in this example, the internal DAC reference voltage is from the internal 1.8v PAD and the DAC output voltage is half of the reference.

Prepare the Demo
  1. Connect a USB cable between the host PC and the MCU-LINK 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 demo.

Running the demo

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

The example compares analog input to the reference DAC output(CMP positive port).
The terminal will print CMP's output value when press any key.
Please press any key to get CMP's output value.
The analog input is LOWER than DAC output
The analog input is HIGHER than DAC output
FRDM-IMXRT1186
Hardware requirements
  • Micro USB cable

  • FRDM-IMXRT1186 board

  • Personal Computer

Board settings

Remove Jumper J29.

This example project uses ACMP instance 3 to compare the voltage signal input from External Input2 J29-2(GPIO_AD_29) with the voltage signal(half of VDDA_1P8_IN) output by ACMP’s internal DAC. Terminal will print information corresponding to different comparison result. Please note that the input voltage should in the range of 0 to 1.8V. Connect ACMP External Input2(GPIO_AD_29) to stable external voltage generator to avoid floating voltage. The example serial port output may be frequent change otherwise.

Please note this application can’t support running with Linux BSP!

Prepare the Demo
  1. Connect 5V power supply and J-Link Debug Probe to the board and power on the board.

  2. Connect a micro USB cable between the host PC and the J53 USB port on the target board.

  3. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  4. Download the program to the target board.

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

Running the demo

If the input voltage input is in the range of 0.9V to 1.8V, that means the analog input is higher than DAC output. If the input voltage input is in the range of 0V to 0.9V, that means the analog input is lower than DAC output.

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

The example compares analog input to the reference DAC output(CMP positive port).

The terminal will print CMP's output value when press any key.

Please press any key to get CMP's output value.

The analog input is LOWER than DAC output

The analog input is HIGHER than DAC output