User manual
Tutorial
© 2008 Microchip Technology Inc. DS51616B-page 49
2. Highlight the variable counter from the following line of code:
counter++; //increment counter
Right click on the highlighted variable and select “Log Selected C Value” from the
pop-up menu. This causes the following macro line to be inserted above the line
containing the variable:
__LOG(id,counter);
where id is a log number auto-generated during build.
3. Rebuild the project (Project>Build All
).
4. After rebuilding, a Warning dialog will ask, “File has been modified. Do you want
to reload?”. Click Yes. When you examine your code, you will find that the log id
has been replaced with a unique number.
5. Reprogram the device (Debugger>Program
).
6. Double-click on the following line to place a breakpoint there:
PORTA = counter; //display on port LEDs
7. Reset and run the program until it halts at the breakpoint. Repeat this three times.
8. Select View>Trace
to view the trace data (Section 11.3.11 “Trace Window”) or
right click and in the Trace window and select “Reload”. You should see variable
values logged in this window. To see the related code in the lower portion of the
window, you may need to click on a logged value in the upper portion of the win-
dow.
FIGURE 4-20: VIEW TRACE WINDOW – LOG VARIABLE
Note: To disable this warning and automatically reload, select
Configure>Settings
, Other tab, and check “Automatically reload files
that were modified outside of the IDE”. Then click OK.