Listing 1—Language purists will have none of it, but I like the fact Dynamic C is custom tailored to the hardware with language extensions for I/O, interrupts, memory management, and, in this case, multitasking.
main()
{
initPort(); //Initializes port G only
while (1)
{
costate
{ //DS1 LED
DS1led(ON); //On for 50 ms
waitfor(DelayMs(50));
DS1led(OFF); //Off for 100 ms
waitfor(DelayMs(100));
}
costate
{ //DS2 LED
DS2led(ON); //On for 200 ms
waitfor(DelayMs(200));
DS2led(OFF); //Off for 50 ms
waitfor(DelayMs(50));
}
}
}