Getting Started with GPIO on PIC18
An embedded system is capable of exchanging stimuli with the outside world using General-Purpose Input/Output
(GPIO) ports. GPIO pins are clustered in PORTs and the PIC18 devices provide multiple PORT modules. This technical brief explains the concepts behind PORT modules and their functionality on the PIC18 family of
microcontrollers by implementing the use cases presented below.
• GPIO Read/Write Example: This example shows how to read an input pin value, changed by pressing a button, and how to set an output pin value in order to turn an LED on and off.
• Using GPIO Interrupts: This example shows how to enable the Interrupt-on-Change (IOC). The IOC is configured to be triggered on the falling edge detected on the desired input pin.
• Wake-Up from Sleep: This example shows how to reduce power consumption by enabling Sleep mode on the device and waking it up using the IOC, with a button controlling the input pin value.
General-Purpose Input/output (GPIO) ports, GPIO pins, PORTs, PIC18 devices, GPIO Read/Write, GPIO Interrupts, Wake-Up from Sleep, MPLAB® Code Configurator (MCC)