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.