Gerhard Fiedler wrote: > On a side note: Even though I'm really a fan of programming in something > more comfortable than pure assembly, I think such delay loops are an > example where resorting to assembly (embedded in C) makes sense. The reason > is that the exact number of cycles may vary between different versions of a > compiler, and rather than counting them every time a version changes, > getting it once right in assembly seems to be a better choice. I agree - you never know when an additional optimization will mess with your carefully-timed loop. Also, most PIC compilers I've worked with include a delay function in the standard library. BoostC, for instance, includes several delay routines of various lengths that are adjusted to match the clock frequency, which you specify in a #pragma. -- Timothy J. Weber http://timothyweber.org -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist