Page 1 of 1

MOD54415 TimerTick

Posted: Thu Oct 23, 2014 12:44 pm
by jediengineer
So a long time ago, I found a bit of HTML in the factory demo that called the system for a tick count which would display the number of seconds that the system had been running for (TimeTick/TICKS_PER_SECOND) - I found the HTML code, but for the life of me I cannot find any reference to the function it calls for some reason. I need to store a DWORD of the total time the system was turned on for, can't find a reference to the system timer. Can someone point me in the right direction? Thanks!

Re: MOD54415 TimerTick

Posted: Thu Oct 23, 2014 1:01 pm
by sulliwk06
I believe there is a Secs variable you can use.

Re: MOD54415 TimerTick

Posted: Mon Oct 27, 2014 12:38 pm
by jediengineer
I couldn't find a "Secs" variable, but I did find this in utils.h:

Code: Select all

extern DWORD GetPreciseTime( void );              // Gets the time tick since system start at a higher
                                                  // resolution, depending on the platform:  0.868-us for
                                                  // MOD5234/70, and 1.929-us for MOD5282
From what I gather, it's keeping a tick count, each tick being 1/20th of a second? At least for the MOD5441X platforms... the header didn't specify anything for the MOD5441X family. If I'm wrong, someone please fill me in... thanks!

Re: MOD54415 TimerTick

Posted: Mon Oct 27, 2014 12:50 pm
by dciliske
Nope, that's not what GetPreciseTime does; it gets the sub-tick time from the hardware timer and returns the total hardware counts. This has a lower rollover than simply tracking TimeTick.

'Secs' is the name of the number of seconds since boot, it's declared as a VDWORD, or 'volatile unsigned long', inside 'ucos.c'. It is declared on line 62 of 'utils.h'

-Dan

Re: MOD54415 TimerTick

Posted: Mon Oct 27, 2014 7:56 pm
by pbreed
To add to Dan's comment...

TimeTick is the number of ticks since boot.

From utils.h....

extern VDWORD Secs; // Number of seconds since system start
extern VDWORD TimeTick; // Number of time ticks since system start

Re: MOD54415 TimerTick

Posted: Tue Oct 28, 2014 7:11 am
by jediengineer
Thanks guys - appreciate it. Looks like what I was looking for! Apologies if that was too simple... I completely missed that when I looked in utils.h...