> I'd like to specify that, and not have to worry about how many > instructions I spent doing those other things. And I want to be able > to specify that in loops too. We have something trivial like: #define TIMER_START(timer, ms) (timer = msclock() + ms) #define TIMER_RUNNING(timer) (msclock() < timer) where msclock() returns some automatically-incremented counter (interrupt driven here, but it could be a cycle counter if you have one, or a bare timer register.) Then you can do TIMER_START(my_timer, 10); /* Wait for at least 10 ms */ do_some_work(); do_some_more_work(); : work_almost_done(); while (TIMER_RUNNING(my_timer)) ; /* Wait for rest of 10mS to pass */ Beware counter wraparound and sign changes... BillW -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist