User manual

Tutorial
© 2008 Microchip Technology Inc. DS51616B-page 53
4.15.1.2 MPLAB IDE SETUP
To set up MPLAB IDE software to use SPI Trace, do the following:
1. Launch MPLAB IDE and open the project from this tutorial, if it is not already
open.
2. If the MPLAB REAL ICE in-circuit emulator is selected as the programmer, dis-
able it by selecting Programmer>Select Programmer>None
.
3. Enable the MPLAB REAL ICE in-circuit emulator as the debug tool by selecting
Debugger>Select Tool>REAL ICE
.
4. On the Project toolbar, select “Debug” from the Build Configuration drop-down
list. (For some devices, an i version of the linker script is also necessary for
debugging, e.g., 18F8722i.lkr.)
4.15.1.3 TRACE SETUP
To log a variable value using SPI Trace:
1. Select Project>Build Options>Project
, Trace tab. Check “Enable Trace” and
uncheck “Disable Trace Macros”. Then select the SPI Trace and choose an SPI
port from the drop-down list. Click OK.
FIGURE 4-22: BUILD OPTIONS DIALOG – SPI 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
).