Hey all,
I'm trying to set up the HIRES timer to trigger an event every tenth of a second. I dug through the example files and looked at the hires timer demo which takes a value from the serial buffer and puts it in the timer like this:
iprintf( "Input number of seconds (floating point) between LED increments:" );
gets( Buffer );
timer->init(strtod( Buffer, NULL ) );
So if I want this timer to fire off my ISR every 10th of a second, can I just replace "buffer" in the timer->init line with a floating point number?
If not, what is a good way to set up a DMA timer without screwing up the uCOS?
Sorry for the dumb question, still learning C++ on the fly.... Thanks!!
Tony
MOD54415 hires timer
Re: MOD54415 hires timer
If you really need 1/10 second, just say:
timer->init((double)0.1);
I used a constant for an 8khz timer, and it worked fine.
timer->init((double)0.1);
I used a constant for an 8khz timer, and it worked fine.
Re: MOD54415 hires timer
You shouldn't need that explicit cast to double 0.1 is a double implicitly. 0.1f is the literal syntax for a float.
Code: Select all
timer->init((double)0.1);
-
- Posts: 192
- Joined: Mon Dec 17, 2012 6:24 am
Re: MOD54415 hires timer
thanks guys! So since the input has to be a floating point number, then I can just use:
timer->init(0.1); ??
I originally declared a floating point constant variable with 0.1 as it's value. If that works the same, then I'm set. Just trying to simplify the code a little. Thanks!!
Tony
timer->init(0.1); ??
I originally declared a floating point constant variable with 0.1 as it's value. If that works the same, then I'm set. Just trying to simplify the code a little. Thanks!!
Tony