Lab 3
Lab3 Abstract
Lab 3a – GPIO
This lab creates what is often called, the "Embedded Hello World" program.
Your code will blink the Launchpad’s LED example using the MSP430ware DriverLib library.
While this is a simple exercise, that’s perfect for learning the mechanics of integrating DriverLib.
Part of learning to use a library involves adding it to our project and
adding its location the
compiler’s search path.
Finally, along with single-stepping our program, we will explore the "Registers" window in CCSv5.
This lets us view the CPU registers, watching how they change as we step thru our code.
Note: Our code example is a BAD way to implement a blinking light ... from an efficiency
standpoint. The _delay_cycles() function is VERY INEFFICIENT. A timer, which we’ll
learn about in a later chapter, would be a better, lower-power way to implement a delay.
For our purposes in this chapter, though, this is an easy function to get started with.
Lab 3b - Button
The goal of this lab is to light the LED when the SW1 button is pushed.
After setting up the two pins we need (one input, one output), the code enters an endless while
loop where it checks the state of the push button and lights the LED if the button is pushed down.
Basic Steps:
- Cut/Paste previous project
- Delete/replace previous while loop
- Single-step code to observe behavior
- Run, to watch it work!
Note: "Polling" the button is very inefficient!
We'll improve on this in both the Interrupts and Timers chapters and exercises.
3 - 20 MSP430 Workshop - Using GPIO with MSP430ware