Co-operative multi-tasking is the way to do it. Every task that you want to execute has to execute in a RTC(run to completion) manner. You should write tasks in such a way that no single task ever blocks(hogs the CPU). Every person may implement this differently. Most will prefer the super-loop structure of task management in tiny embedded systems. Medium / large embedded systems can afford the use of RTOSes since they have sufficient memory to handle such overheads.
A good way would be to read up on ProtoThreads and see how they mangle C to implement the super-loop task management. Wikipedia might help for information on co-operative multitasking.
Bookmarks