Breakpoints And Stopwatch

Use breakpoints to halt code execution at specific lines in your code. Use the stopwatch with breakpoints to time code execution.

  • Breakpoint Resources
  • Hardware or Software Breakpoint Selection
  • Breakpoint and Stopwatch Usage

Breakpoint Resources

In 16-bit devices, breakpoints, data captures and runtime watches use the same resources. Therefore, the available number of breakpoints is actually the available number of combined breakpoints/triggers.

In 32-bit devices, breakpoints use different resources than data captures and runtime watches. Therefore, the available number of breakpoints is independent of the available number of triggers.

The number of hardware and software breakpoints available and/or used is displayed in the Dashboard window (Window>Dashboard). Not all devices have software breakpoints.

Hardware or Software Breakpoint Selection

To select hardware or software breakpoints:

  1. Select your project in the Projects window. Then, select File>Project Properties or right click and select 'Properties'.
  2. In the Project Properties dialog, select 'ICD4' under 'Categories'.
  3. Under 'Option Categories', select 'Debug Options'.
  4. Check 'Use software breakpoints' to use software breakpoints. Uncheck to use hardware breakpoints.

Using software breakpoints for debugging impacts device endurance. Therefore, it is recommended that devices used in this manner are not be used as production parts.

To help you decide which type of breakpoints to use (hardware or software), the following table compares the features of each.

HARDWARE VS. SOFTWARE BREAKPOINTS

FEATURES Hardware Breakpoints Software Breakpoints
Number of breakpoints Limited Unlimited
Breakpoints written to* Internal Debug Registers Flash Program Memory
Breakpoints applied to** Program Memory/Data Memory Program Memory only
Time to set breakpoints Minimal Dependent on oscillator speed, time to program Flash Memory, and page size
Breakpoint skidding Most devices No

*Where information about the breakpoint is written in the device.
**What kind of device feature applies to the breakpoint. This is where the breakpoint is set.

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.