Lab 3
Verify Code
10. Build & Load program.
11. Add the usiButton1 variable to the Watch Expression window.
Hint: select the variable name before you right-click on it and add it to the Watch window.
12. Single-step project. Watch the LED and variable.
Loop thru while{} multiple times with the button pressed (and not pressed), watching the
variable (and LED) change value.
13. Run the program.
Go ahead and click the Run toolbar button and revel in your code, as the LED lights
whenever you push the button.
Note: This is not efficient code. It would be much better to use the push-button input pin as an
interrupt … which we’ll do in Chapter 5.
Optional Exercises
• Try this lab without pull-up (or pull-down) resistor.
Without the resistor, is the pushbutton’s value always consistent?
(yes / no) _______________
• Try using the other LED on the board …
• … or the other pushbutton.
3 - 34 MSP430 Workshop - Using GPIO with MSP430ware