2.77 Parallel Input/Output (PIO) Controller

The Parallel Input/Output Controller (PIO) manages up to 32 fully programmable input/output lines. Each I/O line may be dedicated as a general-purpose I/O or be assigned to a function of an embedded peripheral. This ensures effective optimization of the pins of the product.

Using The Library

The PIO peripheral library provides two kinds of functions which can be used to control PIO Pins:

  • Pin Functions.

  • Port Functions.

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

The PIO peripheral library can generate a callback on a pin interrupt if the pin interrupt is enabled in the MCC.

Library Interface

Parallel Input/Output Controller peripheral library provides the following interfaces:

Functions

NameDescription
PIO_InitializeInitialize the PIO library
PIO_PortReadRead all the I/O lines of the selected port port
PIO_PortWriteWrite the value on the masked I/O lines of the selected port
PIO_PortLatchReadRead the latched value on all the I/O lines of the selected port
PIO_PortSetSet the selected IO pins of a port
PIO_PortClearClear the selected IO pins of a port
PIO_PortToggleToggles the selected IO pins of a port
PIO_PortInputEnableEnables selected IO pins of a port as input
PIO_PortOutputEnableEnables selected IO pins of a port as output(s)
PIO_PortInterruptEnableEnables IO interrupt on selected IO pins of a port
PIO_PortInterruptDisableDisables IO interrupt on selected IO pins of a port
PIO_PinWriteWrites the selected pin
PIO_PinReadRead the selected pin value
PIO_PinLatchReadRead the value driven on the selected pin
PIO_PinToggleToggles the selected pin
PIO_PinSetSets the selected pin
PIO_PinClearClears the selected pin
PIO_PinInputEnableEnables selected IO pin as input
PIO_PinOutputEnableEnables selected IO pin as output
PIO_PinInterruptEnableEnables IO interrupt on selected IO pin
PIO_PinInterruptDisableDisables IO interrupt on selected IO pin
PIO_PinInterruptCallbackRegisterAllows application to register callback for every pin

Data types and constants

NameTypeDescription
PIO_PORTEnumIdentifies the available PIO Ports
PIO_PINEnumIdentifies the available PIO port pins
PIO_PIN_CALLBACKTypedefPointer to a PIO Pin-Event handler function
Note: Not all APIs maybe implemented. See the specific device family section for available APIs.