|ARM Technical Support Knowledge Articles|
Applies to: uVision Debugger
Information in this article applies to:
How can I configure the xtal speed, clock speed, and calculate the execution time of sections of my program using the uVision Debugger?
For each simulated 8051 derivative, VTREGs are defined for the XTAL speed and the CLOCK speed.
The CLOCK speed is the speed of the internal instruction clock. It is derived by dividing the frequency of the external oscillator (XTAL) by an integer value (usually 12).
You may change either of these values and the other is automatically adjusted.
On a standard Intel 8051FA, for example,
XTAL = 12000000
automatically sets CLOCK to 1,000,000 which is 12,000,000 / 12. Other microcontrollers may have a different divisor for the instruction clock.
The uVision debugger includes a system variable named states which contains the number of instruction cycles that have passed. So, to calculate the time it takes a block of code to execute, you must know the starting and ending state values. Then, take the difference and divide by the CLOCK value.
Execution_Time = (End_State_Value - Start_State_Value) / CLOCK;
Article last edited on: 2004-06-29 10:42:24
Did you find this article helpful? Yes No
How can we improve this article?