I really like the simplicity of the Microchip stack where you can ask if how many bytes are in a buffer (for us to pick up data on input), or how much space is available in a buffer (for us to put data in on output). If we're waiting for data, and there's nothing there, we just go on to the next task. The next time we're in the task, we ask again. On the output side, we can either send a part of what we need to send or exit the task and on the next call see if there's then enough room for us to output. I like this second approach in that complete messages are always sent in a single piece. MANY years ago, I wrote a simple multitasking system for an 80286. A separate stack was maintained for each task. The stack held local variables for that task plus the subroutine call stack. A function called NextTask() would move the stack pointer to point to the stack for the next task in the loop, then do a return, loading the program counter with where we left off in that stack. Getting back to I/O (and interprocess communications), each of my processes had an input fifo. When a task was called, it would see if there was anything in its input FIFO. If so, it would take the complete message (which is why I like the complete message transmission described above), process it, then put the results (another complete message) in the input FIFO of another process or I/O device. I wrote a similar system for the PIC18 several years back (see http://www.piclist.com/techref/microchip/language/c/multitask.c.htm ). A difference here was that the stack was copied to a buffer, then copied back to the stack when the task came around again since it was not really practical to keep several stacks on the PIC18 and just move the stack pointer. --=20 FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! Not sent from an iPhone. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .