| Some time ago, there has been a discussion about multitasking and |solutions have been proposed with interrupts ... |Does any of you has an idea of a multitask kernel (2 tasks should cover |most applications) without usong interrupt facilities in order to be put |on a PIC 12C509 for example ? Here's a nice simple method, assuming one of the tasks will fit within 256 bytes of codespace, won't call subroutines more than 1-deep, and no task switch will need to occur within a subroutine. Define a register called "VirtPC". When it starts up, your main task should set it equal to the start address of your "alternate" task. You should also have a code address called "Springboard" at which is coded: Springboard: movf VirtPC,w movwf PC >From the main program, when you want to yield control to the alternate task you just use the two instructions: call Springboard movwf VirtPC When your alternate program wants to yield control, it should either do a retlw $+1 if its execution should resume at the next instruction the next time the main program yields, or else retlw label if execution should resume at /label/. Aside from the restrictions on call depth and the fact that W is trashed on a context switch, this is probably just about the cheapest little multi- tasker for ANY CPU platform (5 cycles to switch to the alternate task; 3 to switch back to the main line). Cute, eh?