??? 08/07/08 07:44 Read: times |
#157294 - Cooperative or preemptive multitasking Responding to: ???'s previous message |
If you want to do two different things (which is suggested by your desire to make the delay non-blocking), then you really need to choose between cooperative multitasking and preemptive multitasking.
In cooperative multitasking, each task is split into small blocks and you use some form of flags and state machines to decide which function gets executed. In preemptive multitasking a time slice interrupt chops tasks up by saving and restoring task contexts. Setting up an execution address which is run on an interrupt is a characteristic of a preemptive system. The 8051 architecture does not lend itself to running a preemptive multitasker efficiently, so I would look at cooperative techniques first. |