Jump to main content

##

# 3.4.17 I/O Pin Controller (PORT)

The IO Pin Controller (PORT) controls the I/O pins of the device. The I/O pins are organized in a series of groups, collectively referred to as a PORT group. Each PORT group can have up to 32 pins that can be configured and controlled individually or as a group.

## Using The Library

PORT PLIB provides two kinds of functions which can be used to control PORT Pins:

- Pin Functions

- Group Functions

Pin functions take a particular pin as input and operates only on that pin without affecting any other pins. Whereas group functions can operate on multiple pins of the same port together.

## Library Interface

peripheral library provides the following interfaces:

Functions

Name | Description
--- | ---
PORT_Initialize | Initializes the PORT Library
PORT_PinWrite | Writes the specified value to the selected pin
PORT_PinRead | Read the selected pin value
PORT_PinLatchRead | Read the value driven on the selected pin
PORT_PinToggle | Toggles the selected pin
PORT_PinSet | Sets the selected pin
PORT_PinClear | Clears the selected pin
PORT_PinInputEnable | Configures the selected IO pin as input
PORT_PinOutputEnable | Enables selected IO pin as output
PORT_GroupRead | Read all the I/O pins in the specified port group
PORT_GroupLatchRead | Read the data driven on all the I/O pins of the selected port group
PORT_GroupWrite | Write value on the masked pins of the selected port group
PORT_GroupSet | Set the selected IO pins of a group
PORT_GroupClear | Clears the selected IO pins of a group
PORT_GroupToggle | Toggles the selected IO pins of a group
PORT_GroupInputEnable | Configures the selected IO pins of a group as input
PORT_GroupOutputEnable | Configures the selected IO pins of a group as output
PORT_PinPeripheralFunctionConfig | Configures the peripheral function on the selected port pin
PORT_PinGPIOConfig | Configures the selected pin as GPIO

Data types and constants

Name | Type | Description
--- | --- | ---
PORT_GROUP | Enum | Identifies the port groups available on the device
PORT_PIN | Enum | Identifies the available Ports pins