Datasheet

Emulator User’s Guide for MPLAB X IDE
DS52085A-page 58 2013 Microchip Technology Inc.
6.3.3.3 I/O PORT TRACE
I/O Port trace can be used with either standard or high-speed communications. Trace
clock and data are provided from a device 8-pin I/O port through the MPLAB REAL ICE
in-circuit emulator logic probe connector.
The I/O port must have all 8 pins available for trace. The port must not be multiplexed
with the currently-used PGC and PGM pins. Therefore, review the data sheet of the
selected device to determine the uninitialized/default port pin states and change them
as necessary.
For hardware connections, see Section 3.6.3 “I/O Port Trace Connections”.
The port interface uses the trace macro format (see Section 6.3.4 “Setting Up Trace
in MPLAB IDE”).
6.3.4 Setting Up Trace in MPLAB IDE
To set up MPLAB X IDE to use trace for the MPLAB REAL ICE in-circuit emulator:
1. Right click on the project name and select “Properties”. In the Project Properties
dialog click on “Real ICE” under “Categories”.
2. Under “Option categories”, select “Clock”. For data capture and trace, the emu-
lator needs to know the instruction cycle speed.
3. Under “Option categories”, select “Trace and Profiling”.
4. Under “Data Collection Selection”, choose “User Instrumented Trace”.
5. Under “Communications Medium” choose either Native, I/O PORT or SPI trace.
6. Set up any other trace-related options. (See Section 11.3.1 Trace and
Profiling”.)
7. Click OK.
Next, enter trace macros in your application code.
To record a PC location, click on or highlight a line of code and then right click to
select “Insert Language Line Trace” fro m the pop-up menu, where Language can
be either C or ASM. This causes the following macro line to be inserted above the
selected line:
__TRACE(id);
where id is a line trace number auto-generated during the build. For more
information, see Section 6.3.9 “More on Trace/Log ID Numbers”.
Note: Inserting a macro into code may modify the logic flow of the program.
Please be sure that braces are present where necessary.