Jinx clear.net.nz> writes: > > Assembly users whole day keep searching how to create 1 us delay > > using 6.167MHz crystal and C users do it in 1 minute just specify the > > clock and ask 1 us delay all done :) > Andre, I don't use C, so what's the solution to making a 1us delay > with 649ns instruction times ? T ~= 648.613588455 pll x8 -> 81.076698556875 nsec 1000 nsec / 81.076698556875 ~= 12.333999999993 divider is 12.333999999993 rounded up to 12.334 as sum of fractions ~= 12 + 1/3 + 1/1000 so, pll x8, divide by 12 (in software), counting loops (of 12). Every 3rd loop of 12 divide by 12+1 and every 1000th loop of 12 divide by 12+1 (but by 12+2 if the 3-s loop count coincides with the 1000-s loop), for a divider error of ~ 2x10-12. If ~ 1x10-5 is enough forget the 1/1000 part. Other dividers and pll settings are also possible. :) except you likely don't want to do it this way. Doing it in hardware (MSI) is left as an exercise >;-)~ Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist