Lab 2 – CCSv5 Projects
MSP430 Workshop - Programming C with CCS 2 - 45
Restart, Single-Step, Run To Line
6. Restart your program.
Let’s get the program counter back to the beginning of our program.
Run Restart - or - use the Restart toolbar button:
Notice how the arrow, which represents the
Program Counter (PC) ends up at main() after
your restart your program. This is where your
code will start executing next.
In CCS, the default is for execution to stop
whenever it reaches the main() routine.
By the way, Restart starts running your code
from the entry point specified in the executable (.out) file. Most often, this is set to your reset
vector. On the other hand, Reset will invoke an actual reset. (Reset will be discussed further
in Chapter 4.)
7. Single-step your program.
With the program halted, click the Step Over (F6) toolbar button (or tap the F6 key):
Run Halt Close Debugger Step Into Step Over Step Return Restart
Notice how one line of code is executed each time you click Step Over; in fact, this action
treats functions calls as a single point of execution – that is, it steps over them. On the other
hand Step Into will execute a function call step-by-step – go into it. Step Return helps to jump
back out of any function call you’re executing.
Hint: You probably won’t see anything happen until you have stepped past the line of code
that toggles P1.0.
8. Single-step 10,000 times
Try stepping over-and-over again until the light toggles again…
Hmmm… looking at the count of 10,000; we could be single-stepping for a long time. For this,
we have something better…
9. Try the Run-To-Line feature.
Click on the line of code that toggles the LED.
Click on the line: P1OUT ^= 0x01;
Then Right-click and select Run To Line (or hit Ctrl-R)
Single-step once more to toggle the LED