Stopwatch.h for MOD54415?
Stopwatch.h for MOD54415?
I have the Stopwatch code from lgitlitz but it needs a
NB_CPU_CLK
value defined.
#if (defined MCF5282 || defined MCF5213)
#define NB_CPU_CLK ( 66355200 )
#elif defined MCF5272
#define NB_CPU_CLK (62500000 / 4096)
#elif defined MCF5208
#define NB_CPU_CLK ( 83335000 )
#elif defined MCF53017
#define NB_CPU_CLK ( 80000000 )
#elif (defined MCF5234 || defined MCF5270)
#define NB_CPU_CLK ( 73728000 )
#else
#error PROCESSOR NOT DEFINED
#endif
What is the right value for the MOD54415?
Thanks!
NB_CPU_CLK
value defined.
#if (defined MCF5282 || defined MCF5213)
#define NB_CPU_CLK ( 66355200 )
#elif defined MCF5272
#define NB_CPU_CLK (62500000 / 4096)
#elif defined MCF5208
#define NB_CPU_CLK ( 83335000 )
#elif defined MCF53017
#define NB_CPU_CLK ( 80000000 )
#elif (defined MCF5234 || defined MCF5270)
#define NB_CPU_CLK ( 73728000 )
#else
#error PROCESSOR NOT DEFINED
#endif
What is the right value for the MOD54415?
Thanks!
Re: Stopwatch.h for MOD54415?
In the latest code release there is a hirestimer.cpp in the MOD5441X directory...
Try using that...
Paul
Try using that...
Paul
Re: Stopwatch.h for MOD54415?
Thanks Paul,
Is there any documentation for this and other new functions beyond the comments in the code?
Or examples?
Like, in void HiResTimer::delay(double delayTime), is delayTime in msec or usec or something else?
Do I have to call start() before using delay()?
The .h file says
"Starts the selected timer. The user MUST call HiResTimerInit for the given timer before calling this method."
but I cannot find HiResTimerInit, does it mean HiResTimer.init() ?
What does the parameter InterruptTime mean for init()?
etc.
Thanks,
Sam
Is there any documentation for this and other new functions beyond the comments in the code?
Or examples?
Like, in void HiResTimer::delay(double delayTime), is delayTime in msec or usec or something else?
Do I have to call start() before using delay()?
The .h file says
"Starts the selected timer. The user MUST call HiResTimerInit for the given timer before calling this method."
but I cannot find HiResTimerInit, does it mean HiResTimer.init() ?
What does the parameter InterruptTime mean for init()?
etc.
Thanks,
Sam
Re: Stopwatch.h for MOD54415?
If I try:
#include <HiResTimer.h>
HiResTimer MOD54415Timer(1);
MOD54415Timer.init();
I get errors that the constructor and destructor are private.
?
Sam
#include <HiResTimer.h>
HiResTimer MOD54415Timer(1);
MOD54415Timer.init();
I get errors that the constructor and destructor are private.
?
Sam
Re: Stopwatch.h for MOD54415?
In cpp a constructor is called when you create the object, and the destructor is called when the object goes out of scope. So you don't call those directly. I don't have the code to look at, but maybe that info will help a bit.
Re: Stopwatch.h for MOD54415?
Right, but usually there is a public constructor, HiResTimer's are private. I'm guessing that one of the other methods also constructs but I can't see what or how.
Thanks,
Sam
Thanks,
Sam
Re: Stopwatch.h for MOD54415?
did you look at the example in /nburn/examples/utils/HiResTimerDemo?
Re: Stopwatch.h for MOD54415?
Nope, I missed that one, thanks!
It looks like it will answer my questions.
Sam
It looks like it will answer my questions.
Sam
Re: Stopwatch.h for MOD54415?
As the developer responsible for the port from Larry's original StopWatch library, I'll try to clarify a couple things.
First of all, my apologies for the typo in the header file when referring to HighResTimer.init(). There is a full set of documentation in the Runtime Library document, in section 22.
As for the issue with the constructor, this was a deliberate design choice. The HighResTimer acts as a user friendly interface onto the processor's DMA timers. With this in mind, it should be obvious that there is a finite supply of potential HighResTimers. Therefore, the class is designed to enforce safe utilization of the resources and deny unrestricted access to instantiation of timers. If you are familiar with design patterns, you will note that this is a Singleton class, with multiple instances.
First of all, my apologies for the typo in the header file when referring to HighResTimer.init(). There is a full set of documentation in the Runtime Library document, in section 22.
As for the issue with the constructor, this was a deliberate design choice. The HighResTimer acts as a user friendly interface onto the processor's DMA timers. With this in mind, it should be obvious that there is a finite supply of potential HighResTimers. Therefore, the class is designed to enforce safe utilization of the resources and deny unrestricted access to instantiation of timers. If you are familiar with design patterns, you will note that this is a Singleton class, with multiple instances.
Dan Ciliske
Project Engineer
Netburner, Inc
Project Engineer
Netburner, Inc
Re: Stopwatch.h for MOD54415?
Thanks Dan,
Somehow I thought the HiRes timer was newly implemented for the MOD54415, so I didn't look in the Runtime Libraries docs. My bad.
Sam
Somehow I thought the HiRes timer was newly implemented for the MOD54415, so I didn't look in the Runtime Libraries docs. My bad.
Sam