8 Pin Configuration

8.1 Pins Selection: Finding Schematics

To select any of the required pins for a given example, refer to the schematic of the board you are using. Examples can often be run on a range of hardware, selecting appropriate pins for a LED, Analog Input (ANx), UART Tx/Rx, etc.

If the Curiosity Nano platform is being used, the following guidelines will be useful.

When plugging in a Curiosity Nano evaluation kit, MPLAB® X IDE will open the Kit Window tab, which contains a number of useful links for the particular board that you have.

Click the Curiosity Nano Schematics link, as shown in the image above, to quickly find the UART connected to the USB CDC of the Curiosity Nano debugger. In addition, the user can quickly find the LED, Button and Debug GPIO pins.

Tip: For an introduction to the Data Visualizer, see Visual Debugging with MPLAB® Data Visualizer.

8.3 Pins Selection: LED, BUTTON and Debug GPIO

Many examples include General Purpose Input/Output (GPIO). Since the default naming convention for PINs in MCC Melody starts with IO_, all the I/O pins in examples follows this convention. For example, IO_LED or IO_BUTTON.

Tip: Use Curiosity Nano Schematics, to help to find Curiosity Nano Platform references.
Tip:
  1. Set the active low LED as output, rename to IO_LED.
  2. Set the active low BUTTON with no pull-up resistor as input, enable Weak Pull-up, set Interrupt-on-Change to Negative.

Debug GPIO pins are also provided on the Curiosity Nano via the Data Gateway Interface (DGI). Debug GPIO are particularly useful for a rough verification of application timing.

Tip:
  1. Go to AVR TCA PLIB Driver, PIC Timer0 PLIB Driver for a video on how to use the MCC Melody 100 ms Timer.
  2. If you are new to MPLAB® Data Visualizer, see Debug GPIO Hello World (Microchip University).

8.4 Pins Configuration for Interrupt on Change /Input Sense

Many examples include General Purpose Input/Output (GPIO). Since the default naming convention for PINs in MCC Melody starts with IO_, all the I/O pins in examples follows this convention. For example, IO_LED or IO_BUTTON.

When working with pin interrupts, for PIC16F/18F these are referred to as Interrupt on Change, while on AVR they are Input/Sense Configuration (ISC). See below examples for PIC16F/18F and AVR respectively.

Tip: PIC18F57Q43: Pin Grid View ➔ <Select SW pin as input>, Pins ➔ Rename Custom Name to IO_Reset, Enable (weak) pullup, Select INTERRUPT on Change: Negative
Tip: AVR128DB48: Pin Grid View ➔ <Select SW pin as input>, Pins ➔ Rename Custom Name to IO_Reset, Enable Pull-up, Select Input/Sense Configuration (ISC): Sense Falling Edge.

8.5 Pins Selection: UART Tx/Rx

Once a UART Driver is added, your schematic must be referenced to select the right UART PLIB as a dependency. To do this, the schematics of your board must be referenced.

Tip: Use Curiosity Nano Schematics to help to find Curiosity Nano Platform references.
Tip:
  1. The image above depicts an example for the Q71, where UART2 is connected to the Serial/CDC port, UART Tx is RB4 and Rx is RB5.
  2. Different UARTs can be used for certain PIC MCUs due to Peripheral Pin Select (PPS). In this case, the specific pins used for UART Tx and UART Rx play a significant role.

  3. It is possible to connect from the Serial/CDC port on the Curiosity Nano to either the Data Visualizer or a separate terminal program.
  4. For an introduction to the Data Visualizer, see Visual Debugging with MPLAB® Data Visualizer.