Byte Craft implemented a embedded library that has delay routines in it (arguments in us ms ) This library has identical calling sequences for several compilers. Because the delay is a compiler supported library code written using the calling conventions is portable over diverse architectures. These are strictly delay libraries rather than interleaved delay and executable code next event. the bigger issue in this thread is how to generate delays automatically and still be able to use the cycles for other work by the processor. There are two solutions turn off interrupts or use timers (with or without interrupts) . Compilers could track the instruction time, easy with straight line code and more complex with when branches or loops are involved. It would probably be trade-off between optimization and exact timing. I agree with Wouter that as far as I know no C compilers have done this for embedded systems. w.. . Wouter van Ooijen wrote: > I don't see how your code handles an as-yet-undefined chip, it does only > PIC and 8051. It can of course be extended for another specific chip, > but it can't handle a new chip without additions/changes. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist