Page 1 of 1

How to measure time

Posted: Mon Apr 29, 2013 12:40 pm
by nestor
Hello,

how I can to measure time with the function

Code: Select all

TimeAbsType GetTime()
?

I am using FLEX FULL board. I need any special include in my code?

Now I put something like this in my code:

Code: Select all

TimeAbsType t = GetTime();
and I am obtaining this error:

Code: Select all

error: syntax error before 't'
warning: type defaults to 'int' in declaration of 't'
warning: implicit declaration of function 'GetTime'
error: initializer element is not constant
warning: data definition has no type or storage class
Exists another way to measure time?

Thanks

Re: How to measure time

Posted: Mon Apr 29, 2013 1:35 pm
by paolo.gai
Hi,

the best way is to look at an unused timer, start it, and read the timer register before and after the event you need to measure. It will be a rough measure in any case.

Most demos contain info on how to start / stop timers.

or you can use EE_hal_gettime defined in mcu/microchip_dspic/inc/ee_mcu.h which uses timer8 and timer9.

Ciao,

PJ