MPLAB® Harmony v3 Peripheral Libraries on PIC32MZ EF: Step 3

Last modified by Microchip on 2023/11/09 09:09

Configure Pins for Switch and LED

Configure switch button pin with General Purpose Input/Output (GPIO) interrupt handler

The switch button will be configured as per the design schematic of the Curiosity PIC32MZ EF 2.0 Development Board shown in the accompanying image.

button 1 schematic

In the MPLAB® Code  Configurator (MCC), select the Pin Settings tab and sort (Order) the entries by Ports.

Sorting pins

Scroll down to GPIO pin RJ4 (Pin Number 131) in the Pin ID column and configure RJ4 as an external interrupt pin for SW1 switch functionality. Internal pull-up is enabled to avoid false edge detection as there is no external pull-up on the Curiosity PIC32MZ EF 2.0 Development Board.

Switch pin configuration

Back to Top


Configure LED pin

The user LED will be configured as per the design schematic of the Curiosity PIC32MZ EF 2.0 Development Board shown in the accompanying image.

LED Schematic

Select the Pin Settings tab and then scroll down to GPIO pin RJ7 (Pin Number 134) in the Pin ID column and configure RJ7 as an output pin for LED1 functionality.

LED pin configuration

Note: The LED1 on the Curiosity PIC32MZ EF 2.0 Development Board is active low. Configure the LED1 in the default OFF state by configuring the latch value to logic High.

Back to Top


Rename the default main file

Under the Project Graph tab, click on System, and give a name of your liking to the default template main file generated by the MCC.

Main file name setup

Note: The name of the default main.c is changed to main_pic32mz.c to indicate that the referred main.c is for the PIC32MZ EF "Getting Started Training Module".

Back to Top