User manual
Tutorial
© 2008 Microchip Technology Inc. DS51616B-page 55
4.15.2.3 TRACE SETUP
To log a variable value using I/O Port Trace:
1. Select Project>Build Options>Project
, Trace tab. Check “Enable Trace” and
uncheck “Disable Trace Macros”. Then select the I/O Port Trace and choose an
port from the drop-down list. Click OK.
FIGURE 4-23: BUILD OPTIONS DIALOG – I/O PORT TRACE
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
).
Note: Determining a port that may be dedicated to trace can be a difficult task
on complex devices with many functions multiplexed on port pins. One
suggestion is to use the MPLAB VDI visual device initializer. Not only
can you use it to create initialization code for your application, but you
can add a port to see if it conflicts with any of your other application
peripheral pins. MPLAB VDI information is stored with the workspace.