GPIO is the most basic and most commonly used "communication" used in embedded systems. You can configure them to send [output] or receive [input] information. This information is either a 1 or 0.
Enabling GPIO pins
Port Configuration Registers/Port Control Registers
Modern embedded micro controllers all you to configure a physical pin to behave a certain way via signal multiplexing. Internally, a pin will have several wires connected to it via a multiplexer (wiki) or MUX. A multiplexer selects between several inputs and sends the selected signal to its output pin. In the reference manual you will find a package diagram and/pr chart listing all the modes a specific pin can perform. The Port Control block controls which signal is present on the external pin.
Data Direction Registers
Next, you have to tell the microcontroller if you want the GPIO to be an input or output (or in some cases both). The configuration registers within a microcontroller require proper configuration to select the GPIO as an input or output. The same GPIO pins utilized to blink a LED can be wired to read a signal coming from an external device such as the input from a hall effect sensor. Freescale Cup participants will configure GPIO pins as outputs to control the line-scan-camera via timed pulses and clock type signals.
This is the actual information
In write mode, the GPIO pin can be set, cleared, or toggled via software initiated register settings. To determine which pin on the microcontroller is connected to a LED and how to access it from software, refer to the schematic of the microcontroller board. This pin will have numeric or alfanumeric value as well as an descriptive designation such as PTC7.
Microcontroller Reference Manual: GPIO Information
You will find high level information about GPIO usage in several different areas of a reference manual. See thereference-manual article for more general information.
- Relevant Chapters:
- Introduction: Human-machine interfaces - lists the memory map and register definitions for the GPIO
- System Modules: System Integration Modules (SIM) - provides system control and chip configuration registers
- Chip Configuration: Human-Machine interfaces (HMI).
- Signal Multiplexing: Port control and interrupts
- Human-Machine Interfaces: General purpose input/output