MCUXpresso SDK Documentation

lpadc_single_interrupt

lpadc_single_interrupt#

Overview#

The lpadc_single_interrupt example shows how to use interrupt with LPADC driver.

In this example, user should indicate a channel to provide a voltage signal (can be controlled by user) as the LPADC’s sample input. When running the project, typing any key into debug console would trigger the conversion. ADC watermark interrupt would be asserted once the number of datawords stored in the ADC Result FIFO is greater than watermark value. In ADC ISR, the watermark flag would be cleared by reading the conversion result value. Also, result information would be printed when the execution return to the main function.

Supported Boards#

EVK9-MIMX8ULP
Hardware requirements
  • Micro USB cable

  • MIMX8ULP-EVK/EVK9 board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings
  • Set 0~1.8V voltage input to CH5A(J11-7) by using 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

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Full channel scale (Factor of 1).
Please press any key to get user channel's ADC value.
ADC value: 2714
EVK-MCIMX7ULP
Hardware requirements
  • Micro USB cable

  • MCIMX7ULP-EVK board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings

The example uses CH6A(J11-7) as LPADC input.

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:

LPADC Interrupt Example
ADC Full Range: XXXX
Please press any key to get user channel's ADC value.
ADC value: 2714
EVK-MIMX8ULP
Hardware requirements
  • Micro USB cable

  • MIMX8ULP-EVK/EVK9 board

  • J-Link Debug Probe

  • 5V power supply

  • Personal Computer

Board settings
  • Set 0~1.8V voltage input to CH5A(J11-7) by using 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

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Full channel scale (Factor of 1).
Please press any key to get user channel's ADC value.
ADC value: 2714
EVK-MIMXRT685
Hardware requirements
  • Micro USB cable

  • EVK-MIMXRT685 board

  • Personal Computer

Board settings
  • Set VREF_L to GND, VREF_H to 1.8V (connect JP9, JP10).

  • Input voltage signal(0~1.8V) to J30-1(LPADC0 CH0).

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:

LPADC Single Interrupt Example
Please press any key to get user channel's ADC value.
ADC value: 2714
FRDM-MCXW71
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXW71 Board

  • Personal Computer

Board settings

No special settings are required.

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.

  5. The J6 Pin 1 (ADC0_A6) on EVK board is used to monitor the voltage. The VDD_ANA is used as the ADC reference.

Running the demo

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
MCX-W71-EVK
Hardware requirements
  • Type-C USB cable

  • MCX-W71-EVK Board

  • Personal Computer

Board settings

No special settings are required.

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.

  5. The J4 Pin 9 (ADC0_A6) on EVK board is used to monitor the voltage. The VDD_ANA is used as the ADC reference.

Running the demo

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
KW45B41Z-EVK
Hardware requirements
  • Mini/micro USB cable

  • KW45B41Z-EVK Board

  • Personal Computer

Board settings

No special settings are required.

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.

  5. The J12 Pin 1 (ADC0_A6) on EVK board is used to monitor the voltage. The VDD_ANA is used as the ADC reference.

Running the demo

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
KW47-EVK
Hardware requirements
  • Type-C USB cable

  • KW47-EVK Board

  • Personal Computer

Board settings

No special settings are required.

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.

  5. The J4 Pin 9 (ADC0_A6) on EVK board is used to monitor the voltage. The VDD_ANA is used as the ADC reference.

Running the demo

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
MCX-W72-EVK
Hardware requirements
  • Type-C USB cable

  • MCX-W72-EVK Board

  • Personal Computer

Board settings

No special settings are required.

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.

  5. The J4 Pin 9 (ADC0_A6) on EVK board is used to monitor the voltage. The VDD_ANA is used as the ADC reference.

Running the demo

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
MIMXRT685-AUD-EVK
Hardware requirements
  • Micro USB cable

  • MIMXRT685-AUD-EVK board

  • Personal Computer

Board settings
  • Set VREF_L to GND, VREF_H to 1.8V (connect JP9, JP10).

  • Input voltage signal(0~1.8V) to LPADC0 CH0 (R405, P_5_ADC0_0 side)

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:

LPADC Single Interrupt Example
Please press any key to get user channel's ADC value.
ADC value: 2714
KW47-LOC
Hardware requirements
  • Type-C USB cable

  • KW47-LOC Board

  • Personal Computer

Board settings

No special settings are required.

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.

  5. The J1 Pin 1 (ADC0_A15) on LOC board is used to monitor the voltage. The VDD_ANA is used as the ADC reference.

Running the demo

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
MCXW72-LOC
Hardware requirements
  • Type-C USB cable

  • MCXW72-LOC Board

  • Personal Computer

Board settings

No special settings are required.

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.

  5. The J1 Pin 1 (ADC0_A15) on LOC board is used to monitor the voltage. The VDD_ANA is used as the ADC reference.

Running the demo

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
FRDM-MCXW72
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXW72 Board

  • Personal Computer

Board settings

No special settings are required.

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.

  5. The J6 Pin 1 (ADC0_A6) on FRDM board is used to monitor the voltage. The VDD_ANA is used as the ADC reference.

Running the demo

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

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
FRDM-KW43
Hardware requirements
  • Type-C USB cable

  • FRDM-KW43 Board

  • Personal Computer

Board settings

No special settings are required.

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.

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48
FRDM-MCXW70
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXW70 Board

  • Personal Computer

Board settings

No special settings are required.

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.

LPADC Single Interrupt Example
ADC Full Range: 4096
Please press any key to get user channel's ADC value.
ADC value: 48