Datasheet

www.ti.com
Digital I/O Operation
If the pin's pullup/pulldown resistor is enabled, the corresponding bit in the PxOUT register selects pullup
or pulldown.
Bit = 0: The pin is pulled down
Bit = 1: The pin is pulled up
8.2.3 Direction Registers PxDIR
Each bit in each PxDIR register selects the direction of the corresponding I/O pin, regardless of the
selected function for the pin. PxDIR bits for I/O pins that are selected for other functions must be set as
required by the other function.
Bit = 0: The port pin is switched to input direction
Bit = 1: The port pin is switched to output direction
8.2.4 Pullup/Pulldown Resistor Enable Registers PxREN
Each bit in each PxREN register enables or disables the pullup/pulldown resistor of the corresponding I/O
pin. The corresponding bit in the PxOUT register selects if the pin is pulled up or pulled down.
Bit = 0: Pullup/pulldown resistor disabled
Bit = 1: Pullup/pulldown resistor enabled
8.2.5 Function Select Registers PxSEL and PxSEL2
Port pins are often multiplexed with other peripheral module functions. See the device-specific data sheet
to determine pin functions. Each PxSEL and PxSEL2 bit is used to select the pin function - I/O port or
peripheral module function.
Table 8-1. PxSEL and PxSEL2
PxSEL2 PxSEL Pin Function
0 0 I/O function is selected.
0 1 Primary peripheral module function is selected.
1 0 Reserved. See device-specific data sheet.
1 1 Secondary peripheral module function is selected.
Setting PxSELx = 1 does not automatically set the pin direction. Other peripheral module functions may
require the PxDIRx bits to be configured according to the direction needed for the module function. See
the pin schematics in the device-specific data sheet.
NOTE: Setting PxREN = 1 When PxSEL = 1
On some I/O ports on the MSP430F261x and MSP430F2416/7/8/9, enabling the
pullup/pulldown resistor (PxREN = 1) while the module function is selected (PxSEL = 1) does
not disable the logic output driver. This combination is not recommended and may result in
unwanted current flow through the internal resistor. See the device-specific data sheet pin
schematics for more information.
;Output ACLK on P2.0 on MSP430F21x1
BIS.B #01h,&P2SEL ; Select ACLK function for pin
BIS.B #01h,&P2DIR ; Set direction to output *Required*
NOTE: P1 and P2 Interrupts Are Disabled When PxSEL = 1
When any P1SELx or P2SELx bit is set, the corresponding pin's interrupt function is
disabled. Therefore, signals on these pins will not generate P1 or P2 interrupts, regardless of
the state of the corresponding P1IE or P2IE bit.
329
SLAU144JDecember 2004Revised July 2013 Digital I/O
Submit Documentation Feedback
Copyright © 2004–2013, Texas Instruments Incorporated