Timed Pulse Output

techElder

Well-known member
"Wrecking" my brain trying to find the best way to make a selectable, multiple-period pulse generator that is crystal controlled. The 08M2 has enough pins, but I can't get it crystal controlled. Dang, I don't want to dedicate a 28 or 40 for a simple device like this.

I need at least two different periods, but three periods will be perfect. I can use two pins to get four periods with a little ingenuity in the switching.

Must plug into a powered port to provide the pulse to a timing circuit.

Periods range from 0.200 second to 2.000 second. The precision has to be good enough for a 500 uSec rounding that I do in the timer. I'm figuring on at least 3x better, so that would be around 167 uSec. 5x better would be 100 uSec. That would be even better.

So, I was figuring on working from a 1MHz oscillator derived from a 32MHz system clock.

I'm providing this pulse now with an 18M2, but not trying to get the precision --- just a test function.

I'm generating a PAUSE delay to create a negative-going pulse that is AC coupled to a MOSFET to get the negative-going signal output.

I designed (reserved) a little of the PAUSE delay so I can calibrate the output period by adjusting this reserved delay. Seems to work, but I don't think the PICAXE internal clock is real tight over temperature.

What are your thoughts?
 

hippy

Technical Support
Staff member
Between 0C and 60C, with PICAXE +V above 2.5V, the internal oscillator of an 08M2 is accurate to +/-2%, so if you calibrate for 100us at worst you should see 98us to 102us. Even with the worst case of +/-5% that would be 95us to 105us.
 

techElder

Well-known member
2% sounds OK on paper, but for a standard it doesn't sound so good.

I'm wishing for 100 uSecs divided by 2 seconds, or 50 ppm.

So, I'm remembering a post by you, Hippy, where you used an 08(xx) with a 32.768 KHz crystal for a clock source. I know I have it saved locally, but haven't had the chance to search for it. Create the delays, provide a part of the delay for calibration (saved in EEPROM) and add a switch sounds like what I want to do. At the moment, I don't know how additional programming would affect the timing within the 08(xx).

I was looking at 32.768 KHz crystals, and it is easy to find a cheap 20PPM x 20PPM (tolerance x stability). 20PPM is way better than what I was wishing for.

What are your thoughts?
 

hippy

Technical Support
Staff member
It seems you want to generate a reasonably accurate 10kHz signal and the best way to do that would be a suitable crystal, oscillator driver and divider. I can't imagine a 32.768kHz crystal would work because the divisor would be too small and fractional. I think your best bet is an X2 or program up a small PICmicro to do the job.
 

techElder

Well-known member
Yeah, I had a brainfart there.

I did find where I saved some "milliSecond accurate" code that you did with the 20X2. Lots of SFR pokes in there, but no crystal control.

What I didn't want to do was build up from raw hardware with an oscillator and a one-shot.

I started out looking at the 08M2 @32MHz with a PAUSE resolution of 125 uSec. That's over 8 seconds total (x 65536), but if I can't get that with stability then it isn't any good as a standard.

Still working on it ...
 
Top