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.

1514131211109876543210
RD15RD14RD13RD12RD11RD10RD9RD8RD7RD6RD5RD4RD3RD2RD1RD0

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

LEDpin
SWpin
LED1RD0SW1RD6
LED2RD1SW2RD7
LED3RD2SW3RD13

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

Examples

  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