6 Using GPIO within MCC

The MCC is a user-friendly plug-in tool for MPLAB X and MPLAB Xpress IDEs, which generate drivers for controlling and driving peripherals of PIC® and AVR microcontrollers, based on the settings and selections made in the Graphical User Interface. The generated drivers can be used in any application program.

In MCC, the GPIO pins can be configured in the Pin Manager: Grid View window.

Figure 6-1. Pin Manager: Grid View Window

Clicking one of the locks will select the corresponding pin as either input or output, depending on the row clicked. A pin cannot act as input and output at the same time. If the run-time switch between the input and the output is needed, this will have to be manually implemented.

Once selected, the pins will also appear in the Pin Module window.

Figure 6-2. Pin Module Window

Various options can be configured here, most of which have already been discussed in this document. If the Output check box is unchecked, the pin will be input.

MCC generates macros for the pin usage. The prefix of the macros is the pin name, given in the Custom Name field, which is a helpful abstraction if, for example, one pin controls an LED and its macros can be prefixed with LED instead of the actual pin name.

Figure 6-3. Macros for the Pin Usage