[sdiy] RTOS (was Re: sine wave floating point conversion issue)

Olivier Gillet ol.gillet at gmail.com
Sat Feb 25 22:45:30 CET 2012

This works well under the assumption that each task will complete
rapidly. As soon as a task can unpredictably take more time to
complete (say 10 ms in your case), and you still want the other ones
to be executed on a regular time base, this solution won't work. There
are several options then:
* Do everything time critical in a timer ISR, and everything "slow"
and not time-critical in the main code.
* Allow the "slow" task to return mid-way, for example by using
coroutines http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
. The drawback is that you'll have to sprinkle TASK_SWITCH or whatever
macro you have defined everywhere in your tasks code to indicate where
it's OK to break from.
* Use a proper RTOS.

I personally think that an RTOS is overkill for something at the level
of complexity as a synth project (except maybe if it's a
workstation-style thing). I wouldn't do a quadrocopter without though
:) And in Dan's case, who is doing sound generation or Fxs on an AVR
clocked at 16 MHz, this is close to insane.


More information about the Synth-diy mailing list