Intruction time in Hitech C

Status
Not open for further replies.

luanktd

Newbie level 5
Joined
Apr 13, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,328
I write a function in hitech c, but i don't know exact intruction time, can you help me.
- what time to execute once intruction in hitech C?


Code C - [expand]
1
2
3
4
5
6
7
8
void delay( char x, char y)
{
do{
z=y;
do{;}while(--Z);
}while(--X);
}
// x=3,y=3. How many seconds this function delay?

 
Last edited by a moderator:

If the MPLAB IDE is being utilized, you can use the MPLAB Simulator in conjunction with the Stopwatch Tool to measure the execution time of a routine of section of code:

**broken link removed**

**broken link removed**


Of course you can always calculate the duration of execution by counting the instruction cycles required for each of the resulting Assembly Language instructions.


BigDog
 

Thanks Big dog
i think it compiled to ASM, and follow me
Code:
LOOP DECFSZ COUNT_X,0
Code:
GOTO LOOP1
Code:
RETURN
Code:
LOOP1 DECFSZ COUNTY,0
Code:
GOTO LOOP1
Code:
GOTO LOOP

// AND INTRUCTION:
// DESFSZ: 1 CYCLE
// GOTO : 2 CYCLE
// RETURN: 2 CYCLE
// CALL FUNCTION IN HITECH C : 14 CYCLE
// SO RESULT:: DELAY = [3*(Y-1)+4]*[3*(X-1)+2]+14
// EXAMPLE:X=2,Y=8 ::::::::ELAY = [3*(8-1)+4]*[3*(2-1)+2]+14=139 CYCLE
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…