# [SOLVED]How to calculate the time used for each setup as following program

Status
Not open for further replies.

#### thannara123

Hello ,
How to calculate the time used for each setup of the program as following program (example program) If Crystal frequency 12MHz

Code:
while (1)
{
P0 = 0x55;                  // what time take here ?
P2 = 0X55;                 // what time take here ?

delay(250);                // what time take here ? etc ?

P0 = 0x55;
P2 = 0X55;

}

void delay (unsigned int a)
{

Unsigned int i ,j;
for(i=0; i<a; i++)
for(j=0; j<1275; j++)
}

#### doraemon

##### Super Moderator
Staff member
Hello!

This should be in the specs of your processor. It's processor-dependent. Just read the manual.

Dora.

#### thannara123

please assume it as 89s51 . (compiler keil) ( calculate avraege compiler )

#### doraemon

##### Super Moderator
Staff member
Hello!

I think that on simple operation such as assignations, it should not depend on the compiler.
P0 = 0x55 for example, will likely result in the same assembly code for all compilers.
Now I don't understand what you mean by calculate average compiler.

Again, this should be in the 8051 manual. Any assembler instruction should be detailed (how
many clock it takes). Look at what this is translated to in assembler, and then look at your manual.
I would say it's a few clocks, but how many exactly is in the manual.

Dora.

thannara123

### thannara123

points: 2

#### thannara123

sorry I mean normal compiler .

#### doraemon

##### Super Moderator
Staff member
Hello!

What is a normal compiler? Are there abnormal compilers?
Did you read the 8051 manual?

Dora.

Status
Not open for further replies.