ARM Technical Support Knowledge Articles

MEASURING TIME BETWEEN INTERRUPTS

Applies to: uVision Debugger

Answer


Information in this article applies to:


QUESTION

I need to measure the amount of time between 2 interrupts. Is it possible to do this in the uVision 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
", 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

Article last edited on: 2004-11-19 11:35:53

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential