Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

accuracy of a digital clock if using MCU

Status
Not open for further replies.

hm_fa_da

Full Member level 5
Joined
Sep 16, 2003
Messages
287
Helped
10
Reputation
20
Reaction score
4
Trophy points
1,298
Activity points
3,217
hi all ;

how much would be the accuracy of a digital clock made by 8051 using 12.000000 MH crystal ?
and how to calculate it ?
 

You must use timer int. for correct time base interval.Pls read timer section 8051.
 

how much would be the accuracy of a digital clock made by 8051 using 12.000000 MH crystal ?
and how to calculate it ?

It is possible but not very accurate.

Much easier and more accurate is to use external Real-Time ICs and just read the Time (and/or Date) from its registers. These ICs (for examples see MAXIM_IC site) generate periodic interrupts to inform the CPU that next period of time (1s or other) has elapsed..
 

Your 12 MHz oscillator will have some frequency error depending on crystal quality, oscillator circuit design, temperature, aging, etc. That frequency error will cause an equivalent speed-up or slow-down of your clock (if you don't apply some sort of software correction). For example, if your oscillator is actually 12.00012 MHz (that's 0.001% too high, or +10 ppm) then your clock will run 0.001% too fast. Since one day has 86400 seconds, your clock would gain 0.864 seconds per day.

Or maybe you knew all that basic stuff, and were wondering how to compute the actual frequency error of your specific board? Your microprocessor data sheet may say something like this, "if you use this brand crystal and this circuit layout, then the frequency accuracy will be (whatever)".
 

I think this clock accuracy is important if you are very depedent for critical applications involving timers in the long run. That is if application use synchronization. Again if it is in long-run.

For regular ones I think this clock is enough.
 

I have already tried building a digital clock using 8051 @ 11.0592MHz. But it use to loose 3 seconds per day. I had so many tasks to do in the ISR like update the time variables, display time on 7-segments, check for key-presses etc. All this plus interrupt overhead may be causing error which makes "RTC" to "non-RTC".
Or it may be due to crystal frequency variation. I had used standard crystal (the one which comes in rounded rectangular steel tube).

Its better to use RTC ICs like DS1307.
 

A TCXO will improve the accuracy about ten times, but it is also more costly.

If your clock is connected to the power grid you can use the mains frequency
as a reference - provided that the country you live in adjusts the frequency on
a daily basis. During high load hours the frequency drops a little, so during the
night-time it is increased to make up for lost "time".
If you have e.g. a clock radio at home that you never need to set, then your
mains frequency is corrected.
You should use the crystal for short time stabillity and correlate it, in software I
presume, to the mains frequency for long term stability.

How to go about doing it, I leave up to you... :wink:

/Rambo
 

CMOS, losing 3 seconds per day is -35 ppm. That is typical accuracy of an inexpensive crystal oscillator (XO).
For example: https://www.ecliptek.com/crystals/ec/

For more money you can add temperature compensation (TCXO), or put the oscillator inside a temperature-controlled chamber (OCXO), or discipline the oscillator using a more accurate frequency reference (Rubidium, Cesium, Hydrogen Maser, etc). Performance and cost increase with each step.

Less expensive methods include synchronizing to somebody else's clock, such as the 50/60 Hz AC mains, WWVB, GPS, or a network time (NTP) server.
 

echo47 said:
Your 12 MHz oscillator will have some frequency error depending on crystal quality, oscillator circuit design, temperature, aging, etc. That frequency error will cause an equivalent speed-up or slow-down of your clock (if you don't apply some sort of software correction). For example, if your oscillator is actually 12.00012 MHz (that's 0.001% too high, or +10 ppm) then your clock will run 0.001% too fast. Since one day hasan 86400 seconds, your clock would gain 0.864 seconds per day.

Or maybe you knew all that basic stuff, and were wondering how to compute the actual frequency error of your specific board? Your microprocessor data sheet may say something like this, "if you use this brand crystal and this circuit layout, then the frequency accuracy will be (whatever)".


what does ppm stand for ?
 

parts per million, it gives the error in a quantity.
 

Although having the same crystal frequecy, difference chip produces difference clock speed. That means it's quite impossible to a high acuracy system.
 

Aside from chips having a different clock speed, the crystal also cannot generate an exact frequency output.

It is always good to get an RTC Chip and putting a TCXO on it.
 

Though mcu clock with external quartz could be very inaccurate , nothing prevents you to use external oscillator with good stability (if mcu allows to use such) .
But there is other concern - how properly you can prevent your mcu design from malfunction ? Any single power failure or firmware fault will force you to
adjust clock time again .
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top