Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

help me, 2 seconds time error in along delay time

Status
Not open for further replies.
My replies may be superceded by later posts, however:

can i use two capacitors each of them 68PF??
Yes.

and in this situation,is the accuracy acceptable?
remember that the circuit is working 24 hours continuously for ayear.
i am afraid of accumulating errors!!!
The frequency of a crystal oscillator depends on the load capacitance on the crystal, in this case two 22pF capacitors in series, plus the circuit stray capacitance.
2 x 22pF in series is 11pf, add 9pF for the strays and you have 20pF.
Depending on how the crystal is made, a common load capacitance is 30pF, so a 30pF crystal in your 20pF circuit would run at a higher frequency than intended.
The accuracy you will get from using twp 68pF capacitors is anyones guess, there is no way of knowing.
The crystal frequency will also change with temperature, how much it will change depends on the crystal, (and the temperature coefficient of the load capacitors).

which is more accurate : delay loops or timer zero??
They both have the same potential accuracy, however when using a delay loop you will have to calculate the number of instruction cycles to give the required delay, using the timer you just have to calculate the division ratio depending on the clock frequency 4Mhz in this case.

If you want long term accuracy, it would be better to extract the timing from a GPS module or a radio controlled clock module, then the time will be accurate to 1 second in a hundred years or so!.

JimB
 
thank you, MR JimB
i plan to use asmall crystal from awatch (( i think it is 32768 HZ)). and to apply the same code to the pic after modifying numbers in delay loops.
i think this crystal is accurate and temperature compensated, because it is used in watches for timing purposes.
do you agree with me?
 
Last edited:
Accurate yes, temp compensated I would think not.

if it is not temp compensated ,then, how they use it in watches and these crystals are working all the time(( for years)) without significant errors in time???
 
Last edited:
i think the error was resulted from actual frequency of crystal.
because i thought the frequency was exactly 32.768 KHZ , but when measuring its frequency with amultimeter , it was
26.5 KHZ!!!!!!!!!!!!!!!!!!!! i was very surprise.
 
i think the error was resulted from actual frequency of crystal.
because i thought the frequency was exactly 32.768 KHZ , but when measuring its frequency with amultimeter , it was
26.5 KHZ!!!!!!!!!!!!!!!!!!!! i was very surprise.

You can't measure frequency in that way - that's why it was wrong.
 
is there any way to determine exactly the frequency of the crystal??
can i use ordinary oscilloscope?

As long as you use a scope with a x10 probe you can monitor it - but really there's little need to - the crystal is labelled with it's frequency, and will be more accurate than the scope.

You really need a trimmer capacitor on the crystal, and adjust it for good time keeping, just as you would adjust a mechanical watch.

But using a less obselete PIC, and using TMR2 to giver regular interrupts is an easy way to make a pretty reasonable clock - your massive delays version is pretty poor.
 
As long as you use a scope with a x10 probe you can monitor it - but really there's little need to - the crystal is labelled with it's frequency, and will be more accurate than the scope.

You really need a trimmer capacitor on the crystal, and adjust it for good time keeping, just as you would adjust a mechanical watch.

But using a less obselete PIC, and using TMR2 to giver regular interrupts is an easy way to make a pretty reasonable clock - your massive delays version is pretty poor.
can you please give me an accurate delay code?
and,what is the value of the trimmer capacitor you suggest ?
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top