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-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 output_t

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 wou

Re: [time-nuts] A Simple PIC Divider

2006-08-07 Thread Rex
On Sun, 6 Aug 2006 19:40:44 -0700, "Tom Van Baak" <[EMAIL PROTECTED]> wrote: >> I don't think any of those chips has a serial port. You would have to do >> (heroic) bit-banging if you needed that. > >True, although simple, robust, and free code samples >for this are all over the web. Or as Chuck

Re: [time-nuts] A Simple PIC Divider

2006-08-06 Thread Hal Murray
> If I wanted to divide a 10MHz clock down to 100KHz, I could do something > like: > #include <12F629.h> > #use delay(clock=1000) > main() > { > while(1){ > delay_us(5); > output_toggle(PIN_A0); > } >} I don't think that will do what I want. The probl

Re: [time-nuts] A Simple PIC Divider

2006-08-06 Thread Bill Hawkins
Wait a second - are you saying that the compiler is smart enough to account for the 'while' and the 'output_toggle' instructions to make the total execution time for the loop be precisely 50 clock ticks? -Original Message- From: Chuck Harris If I wanted to divide a 10MHz clock down to 10

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 assemb

Re: [time-nuts] A Simple PIC Divider

2006-08-06 Thread Tom Van Baak
> I don't think any of those chips has a serial port. You would have to do > (heroic) bit-banging if you needed that. True, although simple, robust, and free code samples for this are all over the web. Or as Chuck mentioned, serial support is included in various PIC compilers. One caution, thou

Re: [time-nuts] A Simple PIC Divider

2006-08-06 Thread Chuck Harris
Hal Murray wrote: >> 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 w

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-05 Thread Tom Van Baak
>While we are on the subject of PIC dividers, and if the lower > order outputs (other than 10kHz) are not required, the standard > divide-by-1000 part of a GPS-derived standard may easily be > implemented in an 8-pin 12F629/675 saving one chip and 20 pins. > > > My code, such as it is - Joe,

Re: [time-nuts] A Simple PIC Divider

2006-08-05 Thread Brooke Clarke
Hi Joe: The PIC 10F200 in a SOT-23 would really be minimal. Have Fun, Brooke Clarke -- w/Java http://www.PRC68.com w/o Java http://www.pacificsites.com/~brooke/PRC68COM.shtml http://www.precisionclock.com Joe McElvenney wrote: >Hi, > > While we are on the subject of PIC dividers, and if

[time-nuts] A Simple PIC Divider

2006-08-05 Thread Joe McElvenney
Hi, While we are on the subject of PIC dividers, and if the lower order outputs (other than 10kHz) are not required, the standard divide-by-1000 part of a GPS-derived standard may easily be implemented in an 8-pin 12F629/675 saving one chip and 20 pins. My code, such as it is - Setup the