Debug for 8- and 16-Bit Devices
? To record a PC location, click on or highlight a line of code and then right click to
select “Insert Language Line Trace” from 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
Note:
Inserting a macro into code may modify the logic flow of the program.
Please be sure that braces are present where necessary.
? The recording of a variable value is performed much in the same way. First high-
light the variable name or expression and then right click to select “Log Selected
Language Value” from the pop-up menu, where Language can be either C or
ASM. This causes the following macro line to be inserted above the line
containing the variable:
__LOG(id ,selected variable );
where id is a log number auto-generated during build and selected variable
is the highlighted variable. For more information, see Section 7.3.10 “More on
? To remove a trace point, simply highlight and then delete the Trace/Log macro.
7.3.6
Running Trace
1. On the Project Manager toolbar, select “Debug” from the Build Configuration
drop-down list.
2. Rebuild the project ( Project>Build All ).
3. After rebuilding, if there are trace macros in code, 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 all id s have been replaced with unique numbers.
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 .
4. Reprogram the device ( Debugger>Program ).
5. Run the program and then halt, or set a breakpoint to halt.
6. 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”. For each __TRACE
macro, the line of code following the macro will appear in the trace window each
time it is passed. For each __LOG macro, the selected variable in the line of code
following the macro will appear in the trace window each time it is passed.
Note:
To trace multiple lines of code or variables, you must place a macro
before each line/variable that you wish to trace.
Repeat these steps each time you change a trace point.
7.3.7
Tracing Tips
When using __TRACE and __LOG macros in your code, consider the following:
? Focus on one area of an application and place __TRACE and __LOG macros so
that they form a “flow” in the Trace window. That way, you can follow the execution
flow and debug the application based on missing/incorrect trace points or an
abrupt end to the trace flow.
? Use __TRACE and __LOG macros with conditional statements in your code to aid
in debugging. Example: When a variable reaches a certain value, start logging it.
? 2008 Microchip Technology Inc.
DS51616B-page 71
相关PDF资料
AC244006 KIT MPLAB REAL ICE TRACE
AC2626M6 PROBE TEMP 6" GENERAL PURP
AC300024 MOTOR STEPPER 2PHASE 8WIRE
AC300030 KIT ACOUSTIC ACCESSORY
ACM-16 CABLE MODULE FR3 16BIT 40-DIP
ACM-2X8 ACTIVE CABLE MODULE DUAL 8 BIT
ACM-8 CABLE MODULE FR3 8BIT 28/32-DIP
ACS9510EVB EVALUATION BOARD FOR ACS9510
相关代理商/技术参数
AC244005-2 功能描述:处理器配件 MPLAB REAL ICE w/ Performace Pak RoHS:否 制造商:Olimex Ltd. 产品:Cable 用于:
AC244006 功能描述:仿真器/模拟器 MPLAB REAL ICE TRACE INTERFACE Brd KIT RoHS:否 制造商:Blackhawk 产品:System Trace Emulators 工具用于评估:C6000, C5000, C2000, OMAP, DAVINCI, SITARA, TMS470, TMS570, ARM 7/9, ARM Cortex A8/R4/M3 用于:XDS560v2
AC244007 制造商:Microchip Technology Inc 功能描述:MPLAB REAL ICE JTAG ADAPTER - Boxed Product (Development Kits) 制造商:Microchip Technology Inc 功能描述:ADAPTER MPLAB REAL ICE JTA 制造商:Microchip Technology Inc 功能描述:ADAPTER, MPLAB, REAL, ICE, JTAG 制造商:Microchip Technology Inc 功能描述:ADAPTER, MPLAB, REAL, ICE, JTAG; Accessory Type:JTAG adaptor Board; For Use With:Microchip PIC32MX devices; SVHC:No SVHC (19-Dec-2012) ;RoHS Compliant: Yes
AC244008 功能描述:处理器配件 MPLAB REAL ICE Power Monitor RoHS:否 制造商:Olimex Ltd. 产品:Cable 用于:
AC244022 功能描述:插座和适配器 Procs Extnsn Pak for PIC24FJ128GA010-ICE RoHS:否 制造商:Silicon Labs 产品:Adapter 用于:EM35x
AC244022 制造商:Microchip Technology Inc 功能描述:Processor Extension Pak for PI
AC244023 功能描述:插座和适配器 PROCESSOR EXTNSN PAK FOR PIC18F1xK50 RoHS:否 制造商:Silicon Labs 产品:Adapter 用于:EM35x
AC244024 功能描述:插座和适配器 Processor Ext Pak for PIC18LF14K50 RoHS:否 制造商:Silicon Labs 产品:Adapter 用于:EM35x