UG-1262
Rev. B | Page 215 of 312
DIGITAL INPUTS AND OUTPUTS OPERATION
Each digital input and output is configured, read, and written independent of the other bits.
General-Purpose Input Data (GPxIN)
The status of the GPIO pins can be read via the GPxIN registers when configured as inputs by the GPxIEN registers.
General-Purpose Output Data (GPxOUT)
The values of the GPxOUT registers are output on the GPIO pins when configured as outputs by the GPxOEN registers.
Input/Output Data Out Enable (GPxOEN)
The GPxOEN registers enable the values of the GPxOUT registers to be output on the GPIO pins.
Input/Output Pull-Up Enable (GPxPE)
In input mode, the GPxPE registers enable and disable internal pull-up resistors. All Port 0, Port 1, and Port 2 pins have internal pull-up
resistors. The pull-up resistors are implemented as metal-oxide semiconductor field effect transistors (MOSFETs), with typical performance
shown in Figure 56.
GPIO Interrupt Enable (GPxIEN)
These registers enable the input pin interrupt sources for individual GPIO pins.
Bit Toggle Mode
Bit toggle mode toggles one or more GPIO data outputs without affecting other outputs within a port. Only the GPIO pins
corresponding to 1 in the GPxTGL registers are toggled. The remaining GPIOs are unaffected.
INTERRUPTS
Each GPIO pin can be associated with an interrupt. Interrupts can be independently enabled for each GPIO pin and are always edge
detecting. Only one interrupt is generated with each GPIO pin transition. The polarity of the detected edge can be positive (low to high)
or negative (high to low). Each GPIO interrupt event can be mapped to one of two interrupts, Interrupt A or Interrupt B, allowing the
system more flexibility in terms of how GPIO interrupts are grouped for servicing and how interrupt priorities are set. The interrupt
status of each GPIO pin can be determined and cleared by accessing the GPxINT status registers. Set the appropriate bit in the GPxIEN
registers to enable the full input path.
Interrupt Polarity
The polarity of the interrupt determines if the interrupt is accepted on the rising or the falling edge. Each GPIO pin has a corresponding
interrupt register (GPxPOL) based on the port in which it is grouped. The interrupt registers configures the interrupt polarity of each
pin. When set to 0, an interrupt event latches on a high to low transition on the corresponding pin. When set to 1, an interrupt event
latches on a low to high transition on the corresponding pin.
Interrupt A Enable
Each GPIO port has a corresponding Interrupt Enable A register (GPxIENA) that is enabled or masked for each pin in the port. The bits in these
registers determine if a latched edge event interrupts the core (Interrupt A) or is masked. In either case, the occurrence of the event is
captured in the corresponding bit of the GPxINT status register. When set to 0, Interrupt A is not enabled (masked). No interrupts to the
core are generated by this GPIO pin. When set to 1, Interrupt A is enabled. On a valid detected edge, an interrupt source to the core is generated.
Interrupt B Enable
Each GPIO port has a corresponding Interrupt Enable B (GPxIENB) register that is enabled or masked for each pin in the port. The bits
in these registers determine if a latched edge event interrupts the core (Interrupt B) or is masked. In either case, the occurrence of the
event is captured in the corresponding bit of the GPxINT status register. When set to 0, Interrupt B is not enabled (masked). No
interrupts to the core are generated by this GPIO pin. When set to 1, Interrupt B is enabled. On a valid detected edge, an interrupt source
to the core is generated.
Interrupt Status
Each GPIO port has an interrupt status register (GPxINT) that captures the interrupts occurring on its pins. These register bits indicate
that the appropriately configured rising or falling edge has been detected on the corresponding GPIO pin.
When an event is detected, GPxINT remains set until cleared, even if the GPIO pin transitions back to a nonactive state. Out of reset,
pull-up resistors combined with falling edge detect can result in the GPxINT status being cleared. However, this may not be the case if
external circuits change the voltage level on the pin. Check the status of the GPxINT registers before enabling the GPxIENA and
GPxIENB interrupts initially, as well as any time the GPIOx pins are configured.