General purpose input pins
Both switches are directly connected between the micro controller pin and ground (0V). Thus when the switch is pressed it will connect the pin to ground and the state of the pin will be read as 0 by the micro controller. When the switch is released the pin is open, this is problematic as an open pin can in principle be at any voltage. This is know as a floating input. To avoid this problem the MSP430’s come with internal software selectable pull-up or pull-down resistors which are used to pull the input either up to +Vcc or down to ground (0V) when the switch is not pressed (open). Most microcontrollers provide either pull-ups, -downs, or both. A simplified circuit diagram for the switch S2 on the MSP430 launchpad when the pull-up resistor is selected is shown below.
Because Switch 2 is from the pin to gr