BreakPoint Hit Count Condition

by Visual Micro 5. May 2012 18:36

Instead of, or in combination with a conditonal breakpoint expression (as described in earlier posts) to make an Arduino trace or break point we can use the "Hit Count" dialog.

The hit count dialog is opened by right clicking any break break and selecting "Hit Count" from the menu that appears (described in detail in earlier posts). The Hit Count dialog allows us to select 4 options.

The example below is self explanatory. If we are adding a break point into a frequent arduino loop we might set a hit count of 30000. In effect this will increment a counter in the code until 3000 is reached, then the breakpoint will be executed prior to the counter being reset to 0. To use a normal "count" for a hit counter then set the project or global property "Hit Count" to "Counter". The default "Hit Count" is "milliseconds"

Tip: The hit count is automatically combined with any conditional expression (as described in earlier posts). Example, we use "break when hit count is a multiple of 250 and we set the HitCount in the project properties to milliseconds (is the default) then we will see a breakpoint or tracepoint 4 times per second (every 250 ms)

How to control the Arduino execution speed during a debug session


note: when using non-breaking tracepoints the stream of debug messages are processed on the pc in batches of up to 10 per second (also depends on the amount of data). The time displayed in the pc debug trace is the time each message is processed on the pc, not the time the message was sent from the micro-controller. For example, we might use a tracepoint at 4hz (every 250ms). In this case the debug data will be an accurate reflection of the micro_controller every 4hz however the millisecond values in the pc trace might not appear enitrely consitent. 

Other Pages