Re: [time-nuts] A Simple PIC Divider

2006-08-07 Thread Glenn
Does anyone have a good solution for the 1-2 us delay between the divider reset (or start) and the first (and later) pulses? I think this might be a good reason to put a serial port on one of the pins. Then, you could send the divider skip x steps or add x steps. I'm not sure if it would

Re: [time-nuts] A Simple PIC Divider

2006-08-07 Thread Chuck Harris
Hi Bill, No, of course it isn't. But for a function as critical as this, surely one would look at the assembly generated. There will no doubt be need to adjust things a little bit. It might end up being something more like: while(1){ delay_us(4); #asm NOP #endasm

Re: [time-nuts] A Simple PIC Divider

2006-08-07 Thread Brooke Clarke
Hi Glenn: The PIC uC chips all divide the incoming oscillator signal by 4 to generate a set of 4 internal clock signals so the actual instruction frequency is Fin/4. A 10 MHz input results in a 2.5 Mhz instruction cycle frequency, or 400 ns per instruction. Any code in the PIC that involves a

Re: [time-nuts] A Simple PIC Divider

2006-08-06 Thread Hal Murray
Right, this is essentially what my (and any other) PIC divider does. Simple, isn't it? And those 8-pin PICs are too cute to pass up. Yup. I saw the light when I was trying to work out a 1/2 second delay with something like a 555. I couldn't quite get what I wanted. Simple in software.

Re: [time-nuts] A Simple PIC Divider

2006-08-06 Thread Chuck Harris
Hi Tom, The CCS C compiler does just fine. When you use the delay function, it is smart enough to know when it is better to insert a few NOP instructions (and other time wasters), and when it is better to toss in a loop. The code it generates is generally better than I can do myself using