Embedded Systems
dispatch.txt
Associated article: A Task Dispatcher for Embedded Systems
Tags: Embedded Systems
Published source code accompanying the article by Ron Kreymborgi in which he presents a dispatcher implemented in C that's small enough to be reliably implemented in the assembly language of the destination processor. Also see DISPATCH.ZIP.
A Task Dispatcher for Embedded Systems
by Ron Kreymborgi
Listing One
InitMulti();
QueTask(TaskA);
while (TRUE) {
Dispatch();
}
Listing Two
TurnLedOn(){
if (switchOn) {
outp(PORTB,0x01);
QueTask(TurnLedOff);
}
else
ReRunMe(0);
}
TurnLedOff() {
if (!switchOn) {
outp(PORTB,0x00);
QueTask(TurnLedOn);
}
else
ReRunMe(0);
}
Listing ...


