MPLAB® Harmony v3 Peripheral Libraries on PIC32CM GV-VL (Arm® Cortex®-M0+) MCUs: Step 3

Last modified by Microchip on 2025/10/09 16:10

Note: This video demonstrates how to configure pins for the External Interrupt Controller (EIC) and LED using MPLAB® Code Configurator (MCC).

Configure Switch Button Pin With EIC to Generate an Interrupt

Configure Switch Button SW200 with the EIC to generate an interrupt. In this step, the switch button will be configured as shown in the following board schematic figure.

USER BUTTON is used to generate an external interrupt that changes the LED's sampling period.

board schematic

 

In MCC, select the Pin Settings tab and then scroll down and configure the pins as follows:

Pin Settings

Enable EIC_EXTINT1 on PB17 to detect the switch press.

Select the Project Graph tab.

Add the EIC to the project. Under the left-side tab, Device Resources, expand Libraries > Harmony > Peripherals > EIC. Select and double-click on EIC to add the EIC module to the project.

EIC to project graph

Set up the EIC block to trigger an interrupt whenever the switch is pressed. Each switch press should modify the LED toggle rate. Enable filter functionality to avoid electrical noise on the switch pin as shown in the accompanying image.

Configuration Options

Back to Top


Configure LED Pin

In this step, the USER LED D200 will be configured as per the following board schematic image.

Schematic

User LED is configured to notify either the periodicity of the LED toggling rate or the periodicity of the LED periodic rate as per Switch press.

Select the MCC Pin Settings tab and then scroll down to the PORT pin PA24 (Pin Number 45) in the Pin ID column and configure PA24 as an output pin for LED functionality as shown in the accompanying image.

Pin Setting tab

Information

The LED output on the PIC32CM GV-VL Curiosity Nano + Touch Evaluation Kit is active low. Configure the LED in the default OFF state by configuring the latch value to logic High.

Back to Top