Programming Energia (and Arduino)
MSP430 Workshop - Using Energia (Arduino) 8 - 11
The remaining colored items show how various pins are used for digital, analog or
communications purposes. The color legend on the right side of the diagram demonstrates the
meaning of the various colors.
Green indicates that you can use the associated pins with the digitalRead() and
digitalWrite() functions.
Purple is similar to Green, though you can also use the analogWrite() function with these
pins.
Yellow , Orange , and Red specify these pins are used for serial communication: UART,
I2C, and SPI protocols, respectively.
Finally, Blue demonstrates which pins are connected to the MSP430’s ADC (analog to
digital converter).
Should you do Pullups or Not?
To reduce power consumption, MSP430 Value-Line Launchpads (version V1.5 and later) are
shipped without pull-up resistors on PUSH2 (S2 or P1_3 or pin 5). This saves (77uA) if port P1_3
is driven LOW. (On your LaunchPad just below the "M" in the text "MSP-EXP430G2" see if R34 is
missing.) For these newer launchpads, sketches using PUSH2 should enable the internal pull-up
resistor in the MSP430. This is a simple change; for example:
pinMode(PUSH2, INPUT); now looks like pinMode(PUSH2, INPUT_PULLUP);
Hardware Pin References
As stated above, the Energia wiki (https://github.com/energia/Energia/wiki/Hardware) and Energia site
(http://energia.nu/Guide_MSP430F5529LaunchPad.html) shows these pin mapping diagrams for each
of the Energia supported boards. You can also refer to the source code which defines this pin
mapping; look for Energia/hardware/msp430/variants/launchpad/pins_energia.h.
This header file can be found on github, or in the files installed with Energia.
Sidebar
How can some ‘pins’ be connected to various pieces of hardware? (For example, PUSH2 and A3
(analog input 3) are both mapped to pin 5.)
Well, most processors today have multiplexed pins; i.e. each pin can have multiple functionality.
While a given ‘pin’ can only be used for one function at a time, the chip designers give users
many options to choose from. In an ideal world, we could just put as many pins as we want on a
device; but unfortunately this costs too much, therefore multiplexing is a common
cost/functionality tradeoff.
Orange