I/O Configuration
371
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
Digital I/O
RETI
; Back to main program
5
P1_0_HND
; Vector 2: Port 1 bit 0
...
; Task starts here
RETI
; Back to main program
5
12.2.6.2 Interrupt Edge Select Registers (PxIES)
Each PxIES bit selects the interrupt edge for the corresponding I/O pin.
•
Bit = 0: Respective PxIFG flag is set on a low-to-high transition
•
Bit = 1: Respective PxIFG flag is set on a high-to-low transition
NOTE:
Writing to PxIES
Writing to
or
for each corresponding I/O can result in setting the corresponding
interrupt flags.
PxIES
PxIN
PxIFG
0
→
1
0
Will be set
0
→
1
1
Unchanged
1
→
0
0
Unchanged
1
→
0
1
Will be set
12.2.6.3 Interrupt Enable Registers (PxIE)
Each PxIE bit enables the associated PxIFG interrupt flag.
•
Bit = 0: The interrupt is disabled
•
Bit = 1: The interrupt is enabled
12.3 I/O Configuration
12.3.1 Configuration After Reset
After a BOR reset, all port pins are high-impedance with Schmitt triggers and their module functions
disabled to prevent any cross currents. The application must initialize all port pins including unused ones
(
) as input high impedance, input with pulldown, input with pullup, output high, or output low
according to the application needs by configuring PxDIR, PxREN, PxOUT, and PxIES accordingly. This
initialization takes effect as soon as the LOCKLPM5 bit in the PM5CTL register (described in the PMM
chapter) is cleared; until then, the I/Os remain in their high-impedance state with Schmitt trigger inputs
disabled. Note that this is usually the same I/O initialization that is required after a wake-up from LPMx.5.
After clearing LOCKLPM5 all interrupt flags should be cleared (note, this is different to the wake-up from
LPMx.5 flow). Then port interrupts can be enabled by setting the corresponding PxIE bits.
After a POR or PUC reset all port pins are configured as inputs with their module function being disabled.
Also here to prevent floating inputs all port pins including unused ones (
) should be
configured according to the application needs as early as possible during the initialization procedure.
Note, the same I/O initialization procedure can be used for all reset cases and wake-up from LPMx.5 -
except for PxIFG:
1. Initialize Ports: PxDIR, PxREN, PxOUT, and PxIES
2. Clear LOCKLPM5
3. If not wake-up from LPMx.5: clear all PxIFGs to avoid erroneous port interrupts
4. Enable port interrupts in PxIE