Texas Instruments MSP-FET430 Computer Hardware User Manual


 
Development Flow
2-11
2.3.4 Using Watch Windows
The C-SPY Watch Window mechanism permits C variables to be monitored
during the debugging session. Although not originally designed to do so, the
Watch Window mechanism can be extended to monitor assembler variables.
Assume that the variables to watch are defined in RAM, say:
RSEG DATA16_I
varword ds 2 ; two bytes per word
varchar ds 1 ; one byte per character
In C-SPY:
1) Open the Watch Window: VIEW->WATCH
2) Use DEBUG->QUICK WATCH
3) To watch varword, enter in the Expression box:
(__data16 unsigned int *) #varword
4) To watch varchar, enter in the Expression box:
(__data16 unsigned char *) #varchar
5) Press the Add Watch button
6) Close the Quick Watch window
7) For the created entry in the Watch Window, click on the + symbol. This will
display the contents (or value) of the watched variable.
To change the format of the displayed variable (default, binary, octal, decimal,
hex, char), select the type, click the right mouse button, and then select the
desired format. The value of the displayed variable can be changed by
selecting it, and then entering the new value.
In C, variables can be watched by selecting them and then dragging-n-dropping
then into the Watch Window.
Since the MSP430 peripherals are memory mapped, it is possible to extend the
concept of watching variables to watching peripherals. Be aware that there may
be side effects when peripherals are read and written by C-SPY. Refer to FAQ,
Debugging #22).
CPU core registers can be specified for watching by preceding their name with
‘#’ (i.e., #PC, #SR, #SP, #R5, etc.).
Variables watched within the Watch Window are only updated when C-SPY
gets control of the device (say, following a breakpoint hit, a single step, or a
STOP/escape).
Although registers can be monitored in the Watch Window, VIEW->REGISTER
is a superior method.