How to measure time

Forum related to ERIKA Enterprise and RT-Druid version 2

Moderator: paolo.gai

Post Reply
nestor
Newbie
Posts: 6
Joined: Tue Feb 09, 2010 5:03 pm

How to measure time

Post by nestor » Mon Apr 29, 2013 12:40 pm

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

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: How to measure time

Post by paolo.gai » Mon Apr 29, 2013 1:35 pm

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

Post Reply