PDA

View Full Version : timing questions with different oscillators



glkosec
- 21st August 2007, 20:06
I was wondering if anyone could maybe explain to me how the micro determines a specific time with different oscillator speeds. Right now I can determine that if im using a 4Mhz internal oscillator and I want to use the PAUSE command, to get a one second delay I simply say PAUSE 1000. But I would like to use the 125Khz internal oscillator of the PIC12F683 and I can't figure out the math to get specific delays using the pause command. Does anyone know the math, it will be very helpful for future projects.

paul borgmeier
- 22nd August 2007, 05:42
Unless redefined, the default OSC speed is 4MHz. If you use a 125kHz Xtal instead of 4MHz, then you can adjust by the ratio

4,000,000/125,000=32

For example:
With a 4MHz Xtal a one second pause would be


PAUSE 1000

With a 125kHz Xtal, a one second pause (approx) would be


PAUSE 31 ' =1000/32