Hi,
I have a program using a 100Hz interrupt as it's timebase. There's a variable (ISRLoop) counting the number of interrupts from 1 to 100 and then it starts over.
Now, I have a couple of different tasks that I need to run (in the main loop - not in the ISR) at various intervalls, like 1Hz, 5Hz, 20Hz, 50Hz and 100Hz for example. The 1Hz and 100Hz are easy but how do I trig the 20Hz and 50Hz ones? Without using something like:
The above may work for the 2 and 5 Hz tasks but won't be very pretty for the 50Hz one.Code:'****Run 5Hz task****** If (ISRLoop = 20) OR (ISRLoop = 40) OR (ISRLoop = 60) '...and so on...
I'm sure there's an elegant solution to this...anyone?
Thank you in advance!
/Henrik Olsson.
Bookmarks