µVISION DEBUGGER: 8051 CLOCK Speed Vs XTAL Speed
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 µVision 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 µVision 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;
Last Reviewed: Friday, February 12, 2021
of your data.