Parallel I/O (PIO) Ports

The input/output (I/O) pins on the microcontroller package are organized into groups of up to 16 pins. Each group is called a port. Ports are named in aphabetical order: Port A ... Port G. Each pin is tied to a bit in an internal register of the microcontroller. The registers are, in turn, mapped to memory locations within the CPU address space. This practice is called memory-mapped I/O.

The association between the pin names and corresponding bit locations is shown below, for Port D.


The development board in the PIC32 Starter Kit has three LEDs and three switches connected to pins in Port D as shown:


Peripheral Library

The peripheral library is a high-level, C-language interface between the programmer and the peripheral devices of the PIC32 microcontroller.

The following include statement should be used to access the peripheral library. The file p32xxxx.h is automatically included as well.

#include <plib.h>

The following documents the basic macros and functions for using digital output and input pins:

Digital Output operations
Digital Input operations


  1. Blinking light: an example of using digital output operations

  2. Light switches: uses the three switches on the PIC32 Starter Kit to control the three LEDs.

Maintained by John Loomis, last updated 18 July 2008