MPLAB® Harmony v3 Peripheral Libraries on PIC32CM GV-VL (Arm® Cortex®-M0+) MCUs: Step 3
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.
In MCC, select the Pin Settings tab and then scroll down and configure the pins as follows:
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.
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.
Configure LED Pin
In this step, the USER LED D200 will be configured as per the following board schematic image.
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.