ARM Technical Support Knowledge Articles

8051 CLOCK SPEED VS XTAL SPEED

Applies to: uVision Debugger

Answer


Information in this article applies to:


QUESTION

How can I configure the xtal speed, clock speed, and calculate the execution time of sections of my program using the uVision Debugger?

ANSWER

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.

For example:

Execution_Time = (End_State_Value - Start_State_Value) / CLOCK;

Article last edited on: 2004-06-29 10:42:24

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