General Purpose Input/Output: All Rights Reserved
General Purpose Input/Output: All Rights Reserved
General Purpose Input/Output: All Rights Reserved
Analogue-to-Digital converter;
Output section
Input section
Independently programmable
individual I/Os
Port3
Port1
Port2
…
Port10 • Each has 8 I/O pins
yes yes
Function Select Register PxSEL
yes no
• Each pin can be
Interrupt Edge Select Register PxIES
• PxDIR configuration:
Bit = 1: the individual port pin is set as an output;
Bit = 0: the individual port pin is set as an input.
• PxIN configuration:
Bit = 1: The input is high;
Bit = 0: The input is low;
• PxOUT configuration:
Bit = 1: The output is high;
Bit = 0: The output is low.
• PxREN configuration:
– Bit = 1: Pull-up/pull-down resistor enabled;
– Bit = 0: Pull-up/pull-down resistor disabled.
• PxIE configuration:
Bit = 1: The interrupt is enabled;
Bit = 0: The interrupt is disabled.
To Input Logic
VCC Button
VCC Button
Button produces
either Vcc Port Pin
or Floating 5.6K
5.6K
input. Adding a
pull-down
resistor fixes it. Some ports have
internal programmable
resistors
Check schematics for LED port location (Consult the Hardware Development
Tool User's Guide);
Use a software delay loop to generate the pause interval (a software delay
loop with a long time period is used here for simplicity - in real applications
a timer would be used).
Copyright 2009 Texas Instruments
All Rights Reserved
17
Example - Blinking the LED (2/4)