On Thu, 6 Mar 2008, Bob Axtell wrote: > Another critical use of assembler is during an interrupt. While HLLs all > offer interrupt code, the extra > instructions generated by the compiler make the interrupt run much > longer. Since when you are in interrupt > mode, you cannot run mainline code, such extra instructions can mean > the difference between a clean > performance and a sluggish, muddy mess. > Hi Bob, If you're talking about the interrupt prolog and epilog code (that which is used to save and restore the context of the processor when switching between interrupt and mainline), apart from updating task timers and the hardware heartbeat timer there are only about a dozen or so instructions of overhead. The interrupt prolog and epilog code can be changed by the user as it is compiled into his/her code from the startup.asm file. If you're talking about the overhead of calling functions from within the interrupt handler then you can rest assured that the overhead can in many cases be reduced to ZERO by the compiler. The compiler generates code for a static runtime stack (there is no pushing, popping or dynamic stack relative addressing at runtime). The actual function arguments of all calls to all functions are analysed and if an argument is found to be invarient and read only within a function, the actual argument is embedded in the function instead of being passed to it at runtime. Passing such invarient arguments therefore has no runtime overhead. Similarly, invarient constants are embedded dirrectly into the function without the need to move them to RAM before calling the function, again reducing runtime overhead. And where possible results are computed and returned directly to the destination (if possible, no copying from a temporary result RAM location). ALSO XCSB supports inline functions (kind of like macros on steroids) which allow further speed optimisations at the expense of code size. XCSB supports multitasking directly so it is trivial to offload time consuming computations from the interrupt handler to a background task. Regards Sergio Masci -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist