> My suggestion would be to check the co-operative
scheduler included and
> explained in this free ebook
> http://www.tte-systems.com/books/pttes
>
> The scheduler is written in C and can be easily ported to any mcu, all
> you need to change is the interrupt handler to match your device.
>
> I doubt that your project needs a pre-emptive RTOS, I'm not even sure
if
> you actually need any OS.
>
> Alex
I have that book! Unfortunately, I have the hardback costly version... Free is
so much better!
I used the scheduler for a PIC project several years ago and it worked out
fine.
If individual tasks can be broken up into tiny morsels and the code written as a
state machine versus a time consuming loop, cooperative multitasking works well.
Loops like the following don't work well for this type of scheduling:
while (<wait for some condition>) {
;
}
<do something>
but something like this will:
void Task1(void)
{
switch(state) {
case WAIT: if (<some condition>) state = DO; break;
case DO: <do something>; state = WAIT; break;
}
}
In the SuperLoop just call Task1 from time to time.
while (1) { // SuperLoop
Task1();
...
...
}
Obviously, there are a bunch of details missing...
Richard
design rtos for lpc2148
Started by ●December 19, 2012