Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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
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 :::::::::DELAY = [3*(8-1)+4]*[3*(2-1)+2]+14=139 CYCLE
 

Have you used the Stopwatch feature in MPLAB SIM to verify your calculation?

BigDog
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top