At 12:44 03/15/99 +0100, Marc wrote: >I would not think so.. What I described is exactly what I do with IAR-C >on an AVR chip (about 350 code words for the whole multitasker). I know >that the PIC has some limitations regarding the stack, but I would have >expected a compiler to hide them from me. Why else should I want to use >one than to hide the architecture? i don't know... when i switch from a dos compiler to a windows 9x compiler to a unix compiler, i =do= expect some differences. or when i switch from a pic compiler to a 80186 to a powerpc compiler, i do expect some differences, too... :) but if you take the limitations of the compiler in account (ie., in most pic compiler no re-entrant user functions), then the compiler does "hide" the architecture. you don't have to know why the limitation is there if you don't want to, you just have to read your compiler's manual and know that it is there. BTW, is your task switcher preemptive (ie. an interrupt may lead immediately to a task switch)? if it is, i don't know how you would implement that on a pic, even in assembler (and therefore shouldn't expect it to be possible in c, neither). if it is not, you don't need reentrant functions for that. state machine-based "task switcher" can be implemented on a pic, and of course with a c compiler, too. (basically you can say that all you can do with assembler on a pic you can do with c. i guess that's as far as you can get in terms of "hiding the architecture"... you can't expect a compiler do things that are not possible on the target hardware, can you?) ge