Keil Logo

µVISION DEBUGGER: MEASURING TIME BETWEEN INTERRUPTS


Information in this article applies to:

  • µVision Version 2.20

QUESTION

I need to measure the amount of time between 2 interrupts. Is it possible to do this in the µVision Debugger?

ANSWER

Yes. There are several ways to measure the time between 2 interrupts (or between any two lines of code for that matter). The easiest way is to create a debugger function that outputs the number of states that have elapsed since the last interrupt.

The following debugger script:

define long last_state;

func void state_diff (void) {
printf ("States = %lu\n", states - last_state);
last_state = states;
}

defines a variable to hold the state count of the last interrupt. Then, a function (state_diff) is created that, when invoked, prints the number of elapsed states to the Command Window and copies the current state count to last_state.

You may copy this script to an .INI file that you start when you run the debugger.

Next, you must add a breakpoint to the interrupt routine that invokes the state_diff() function. For example:

bs c:0x1234, 1, "state_diff()"

Where 0x1234 is the address of the instruction in the interrupt service routine, 1, is the count, and "state_diff()" is the command to execute.

When you run your program, the number of elapsed states will print in the Command window. You can modify this debugger function to output the number of elapsed seconds by dividing the state count by the oscillator frequency.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Friday, November 19, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.