I am using a PIC16F877, using a 20MHz clock, I write code for it in mikroC
I need to find out how long some code took, for example if I have code that takes an unknown time to execute, how can I tell when the code is done, how much time it took to execute ?
Pseudocode:
So what I need is the "time_taken", but how ?
I would prefer to get the time in clocks, or the smallest interval possible, because I need to do things accurately.
I need to find out how long some code took, for example if I have code that takes an unknown time to execute, how can I tell when the code is done, how much time it took to execute ?
Pseudocode:
Rich (BB code):
start_time = current_time;
// some code here that could take any amount of time
end_time = current_time;
time_taken = end_time - start_time;
I would prefer to get the time in clocks, or the smallest interval possible, because I need to do things accurately.