"Russell C. Hay" wrote: > > I just want to make sure that I'm thinking about this correctly. Please > correct me if I'm wrong in this. > > So assuming a 20Mhz PIC (in this case, it's going to be a 16f876), that > means we have 20x10^6 clock cycles per second (duh, right?). Each > instruction cycle is 4 clock cycles, so now we have 5x10^6 instructions per > second, which is basically 12.5x10-6 seconds (12.5 nanoseconds) per > instruction. So, to get a 1 microsecond delay, I'd need 80 instruction > cycles, which in turn means that I'd need 80,000 instruction cycles to get a > 1 milisecond delay. Is this right? > I think my logic (and math) is sound, but since the number is so big, I just > want to ask someone who knows a bit more than me if I'm correct. 20MHz = 50nS per cycle. 4 cycles per instruction = 200nS. 1uS delay = 5 cycles 1mS = 5000 cycles 1S = 5 million cycles etc -- Best regards Tony mICros http://www.bubblesoftonline.com mailto:sales@bubblesoftonline.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads