> 5. You probably use some sort of IDE; these often come with cycle > counters. If you have one, use it. See how many cycles it says your > code is using. Then try other code re-writes to attempt to improve it Good idea. MPLAB has Stopwatch. Always handy for checking >> So incrementing a variable just one time takes 45 clock cycles. I >> know that C isn't as efficient as Assembly language, but I didn't >> expect it to be this inefficient It isn't. Something's not right A 3.579545MHz crystal is an execution frequency of 3.579545/4 = 0.89488625MHz, which is an instruction cycle time (IC) of 1.117us So, to make a delay of 1000us, you need to execute 1000/1.117 = 894.88625 instructions. If you use 895 that's 1000.12us. Decimals will be a problem if you have a crystal that does not divide evenly for your application. If this was a 4MHz crystal, then 1000us = 1000 IC If you have a base 1ms unit as above with 3.579545MHz, then your "1s" will actually be 1s and 120us Can't help you with the C (there's Nothing, and there's me standing next to it) but a loop on that time scale should not be difficult wbr -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist