1.8.13 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 MHC.
Library Interface
peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
PIO_Initialize | Initialize the PIO library |
PIO_PortRead | Read all the I/O lines of the selected port port |
PIO_PortWrite | Write the value on the masked I/O lines of the selected port |
PIO_PortLatchRead | Read the latched value on all the I/O lines of the selected port |
PIO_PortSet | Set the selected IO pins of a port |
PIO_PortClear | Clear the selected IO pins of a port |
PIO_PortToggle | Toggles the selected IO pins of a port |
PIO_PortInputEnable | Enables selected IO pins of a port as input |
PIO_PortOutputEnable | Enables selected IO pins of a port as output(s) |
PIO_PortInterruptEnable | Enables IO interrupt on selected IO pins of a port |
PIO_PortInterruptDisable | Disables IO interrupt on selected IO pins of a port |
PIO_PinWrite | Writes the selected pin |
PIO_PinRead | Read the selected pin value |
PIO_PinLatchRead | Read the value driven on the selected pin |
PIO_PinToggle | Toggles the selected pin |
PIO_PinSet | Sets the selected pin |
PIO_PinClear | Clears the selected pin |
PIO_PinInputEnable | Enables selected IO pin as input |
PIO_PinOutputEnable | Enables selected IO pin as output |
PIO_PinInterruptEnable | Enables IO interrupt on selected IO pin |
PIO_PinInterruptDisable | Disables IO interrupt on selected IO pin |
PIO_PinInterruptCallbackRegister | Allows application to register callback for every pin |
Data types and constants
Name | Type | Description |
---|---|---|
PIO_PORT | Enum | Identifies the available PIO Ports |
PIO_PIN | Enum | Identifies the available PIO port pins |
PIO_PIN_CALLBACK | Typedef | Pointer to a PIO Pin-Event handler function |