1. In the Project window, select the project or make it the main project (right-click the project and select “Set as main”).
2. Click the “Debug Project” icon (or select Debug>Debug Project or Debug>Step Into) to start a debug run.
To pause the application code:
• Click the “Pause” icon (or select Debug>Pause) to pause program execution.
To run the code again:
• Click the “Continue” icon (or select Debug>Continue) to start program execution again.
To end execution of the code:
• Click the “Finish Debugger Session” icon (or select Debug>Finish Debugger Session) to
end program execution.
The difference between Run and Debug Run will become apparent when using the debugging features (starting with Section 4.18, “Controlling Program Execution with Breakpoints”).
To launch the debugger:
If your code was compiled for debugging and you just want to launch the debugging tools, you can do so by selecting the down arrow next to the “Debug Project” icon and selecting “Launch Debugger”.
Setting or Clearing Simple Breakpoints
To set a breakpoint on a line of code, do one of the following:
• Click the left margin of the line of code in the Source Editor
• Press Ctrl+F8
To clear a breakpoint, do one of the following:
• Repeat the steps for setting the breakpoint
• Select Debug>Toggle Breakpoint.
Stepping Through Code
Use one of the single-step functions on the Debug menu and Debug toolbar to step through code from the beginning of the code or after pausing at a breakpoint. Check for changes in variable values (see the next section) or determine if the program flow is correct.
There are several ways to step through code:
Step Over - Executes a line of program source code. If the line is a function call, the entire function is executed and then stops.
Step Into - Executes a line of program source code. If the line is a function call, the program executes to the first statement of the function and then stops.
Step Out - Executes a line of program source code. If the line is a function call, the function is executed and control returns to the caller.
Run to Cursor - Runs the current project to the cursor position in the file and stops program execution.
Animate - Performs single-step operations at run time and updates register values at run time. Continuous single-stepping runs slower than the Run function, but allows you to view changing register values in the Special Function Register window or in the Watches window.
Watch symbol values change
Watch the values of selected symbols change in the Watches window. Determining whether these values are what you expect during program execution can help you debug your code.
To view the Watches window, do one of the following:
• Select Window>Debugging>Watches to open the window.
• If the Output window is already open, click the Watches tab in the window.
To create a new watch directly:
You can add symbols directly to the Watches window by doing one of the following:
• Double-click in the Name column and enter a global symbol, SFR, or absolute address (0x300).
• Right-click a global symbol or SFR in the Editor window and select New Watch.
• Select a global symbol or SFR in the Editor window and drag and drop it into the Watches window.
To create a new watch using the New Watch dialog:
You can add symbols or SFRs to the Watches window by using the New Watch dialog:
• Right-click in the Watches window and select New Watch or select Tools>New Watch. Click the Select button to view Global Symbols or SFRs. Click a
name and click OK.
• Select the symbol or SFR name in the Editor window and select New Watch from the right-click menu.
The name populates in the window. Click OK.
To create a new runtime watch:
Before adding a runtime watch to the Watches window, you need to set the clock:
1. Right-click the project name and select “Properties”.
2. Click the debug tool name (for example, REAL ICE) and select the option category “Clock”.
3. Set the runtime instruction speed.
To add a global symbol or SFR as a runtime watch, follow the instructions under "Creating a new watch using the New Watch dialog box," except this time select "New Runtime Watch" instead of "New Watch."
Symbols used in runtime observations must be resized to match the device memory, that is, 8-bit symbols are required when using an 8-bit device.
To watch a symbol change:
1. Perform a debug run, then pause the program.
2. Click the Watches tab to make the window active.
3. For a watch symbol, continue the debug run and pause to watch the value change. For a run-time watch symbol, continue the debug run and watch the value change as the program executes.
You can only see the value of symbols (global symbols, SFRs, arrays, register bit fields, etc.) when you are in a debugging session.
To change the cardinality of the symbol you are watching:
• Right-click on the symbol's row and select "Display Value As"
To view the Variables window, do one of the following:
• Select Window>Debugging>Variables to open the window.
• If the Output window is open, click the Variables tab in the window.
To view variable changes:
1. Perform a debug run and pause the program.
2. Click the Variables tab to view window and local variable values.
To change the cardinality of a variable:
• Right-click the variable's row and select Display Value As.
Previous article:MPLAB X IDE keeps stopping at the splash screen and cannot be entered. Solution
Next article:Solve the problem of garbled characters in MPLAB X IDE file comments
Recommended ReadingLatest update time:2024-11-23 11:57
- Popular Resources
- Popular amplifiers
- Siemens S7-1200-PLC Programming and Application Tutorial (3rd Edition) (Edited by Shi Shouyong)
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Learning PLC is easy - PLC ladder diagram and statement table with pictures (Li Changjun, Zhou Hua)
- How to read electrical control circuit diagrams (Classic best-selling books on electronics and electrical engineering) (Zheng Fengyi)
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Smart MM32F0270 timer DMA mode output PWM
- If the input power may be 12V or 24V, how should the TVS diode be selected?
- About Lithium Battery Pack Monitoring, SOC and Battery Balancing Technology
- I am going to make a USB sound card myself and give a few to the forum.
- About the font design of single chip microcomputer
- Free evaluation: Pengfeng perf- V fpga development board worth thousands of yuan
- How to use IAR V7.12.1 to program MSP430 series microcontrollers
- sampling
- HuaWei Verilog Constraints
- ESP32 development environment: IDF, Eclipse, vscode simple installation