The Museum of HP Calculators

HP Forum Archive 16

[ Return to Index | Top of Index ]

48 series real time clock
Message #1 Posted by unspellable on 6 Oct 2006, 12:00 p.m.

The HP-48 Series Real Time Clock

A few months ago it was mentioned here that the real time clock in these calculators is not all that accurate. This is not true. The problem is that the speed of the crystal controlled oscillator will vary somewhat depending on variations in the component and circuit parameters. Since the calculator is not really intended as a serious time keeping piece the oscillator frequency is not adjusted to an exact value at the factory. How ever it does run at a reasonably constant speed and so it is not difficult to correct for any deviation from the correct speed. Using such a correction technique the HP-48SX in my office has lost less than one quarter of a second over a period of 193 days. This is better accuracy than most electronic wristwatches. (Granted, it is protected from extreme temperature changes.)

The oscillator frequency is internally divided down to 8192 cps, (cps, not Hz, we are dealing with a digital square wave, not a sine wave here.) and an integer count is kept. The firmware translates this count into the current date and time.

First, create these variables

KORR = 0 DAYS = 0 SEC = 8192

All of these variables are integers

Second, set an alarm at some convenient time such as 2:00 AM to execute the following:

<< KORR CLKADJ DAYS 1 + ‘DAYS’ STO >>

Third, set the real time to the current exact time. (I tune in WWV on my radio for this.) There is a delay in the entry so I usually fine tune the time by entering a few bits via CLKADJ. This correction is 8192 multiplied by the correction and rounded off to an integer.. For example, -1.5 * 8192 to retard the clock by 1.5 seconds.

After a week or so note the discrepancy between the displayed time and the actual time in seconds and enter this value on the stack. This should be a positive value if the clock needs speeding up, a negative value if it needs slowing down. Multiply this number by SEC and divide by DAYS. Store the result in KORR. Store 0 in DAYS. Reset the clock to the exact time.

Now wait two weeks or so and repeat. Repeat as necessary with a longer wait between each iteration. It took me three or four iterations to achieve the one quarter second in 185 days accuracy that I now have. Currently KORR = 8017 for my 48GX.

      
Re: 48 series real time clock
Message #2 Posted by James M. Prange (Michigan) on 6 Oct 2006, 8:23 p.m.,
in response to message #1 by unspellable

Quote:
The HP-48 Series Real Time Clock

A few months ago it was mentioned here that the real time clock in these calculators is not all that accurate. This is not true.


I think that that depends on what you mean by "accurate".
Quote:
The problem is that the speed of the crystal controlled oscillator will vary somewhat depending on variations in the component and circuit parameters. Since the calculator is not really intended as a serious time keeping piece the oscillator frequency is not adjusted to an exact value at the factory.
Thus, as it comes from the factory, it's usually not all that accurate. What's more, no way to adjust the frequency is built in. Adjusting the frequency would require hardware modification; no doubt it is possible, but I haven't read of anyone going to the trouble to do so.
Quote:
How ever it does run at a reasonably constant speed and so it is not difficult to correct for any deviation from the correct speed.
True, the inaccuracy is reasonably constant and predictable.
Quote:
Using such a correction technique the HP-48SX in my office has lost less than one quarter of a second over a period of 193 days. This is better accuracy than most electronic wristwatches.
Okay, with periodic automatic corrections, the long-term average accuracy can be better than most wristwatches; without periodic corrections, I expect that most electronic wristwatches keep better time than the calculators typically do.

Note that the automatic corrections do nothing to improve the accuracy of the clock between corrections, as, for example, using the calculator as a "stopwatch". One can, however, easily enough determine a correction factor to multiply a period of time by.

Quote:
(Granted, it is protected from extreme temperature changes.)

The oscillator frequency is internally divided down to 8192 cps, (cps, not Hz, we are dealing with a digital square wave, not a sine wave here.)


I believe that "Hertz" is a unit of frequency, and that it can be correctly applied to the frequency of any periodic occurrence, including the frequency of a square wave, not just the frequency of sinusoidal oscillations. It seems to me that "Hz" is just as correct as "cps".
Quote:
and an integer count is kept. The firmware translates this count into the current date and time.
For a description of some details of this, see pages 621-622 of Bill Wickes's HP 48 Insights Part II: Problem-Solving Resources, available on the Museum's DVD / CD-ROM set.
Quote:
First, create these variables

[I'm applying some formatting to clarify what you mean.]

KORR = 0
DAYS = 0
SEC = 8192
All of these variables are integers

Second, set an alarm at some convenient time such as 2:00 AM to execute the following:

<< KORR CLKADJ DAYS 1 + ‘DAYS’ STO >>

Third, set the real time to the current exact time. (I tune in WWV on my radio for this.) There is a delay in the entry so I usually fine tune the time by entering a few bits via CLKADJ. This correction is 8192 multiplied by the correction and rounded off to an integer.. For example, -1.5 * 8192 to retard the clock by 1.5 seconds.

After a week or so note the discrepancy between the displayed time and the actual time in seconds and enter this value on the stack. This should be a positive value if the clock needs speeding up, a negative value if it needs slowing down. Multiply this number by SEC and divide by DAYS. Store the result in KORR. Store 0 in DAYS. Reset the clock to the exact time.

Now wait two weeks or so and repeat. Repeat as necessary with a longer wait between each iteration. It took me three or four iterations to achieve the one quarter second in 185 days accuracy that I now have.


Yes, that should work pretty well.

Personally, I rather prefer Eric Postpischil's rather more elaborate TIMEKEEP, available in the utilities directory of Joe Horn's Goodies Disk 9; see http://www.hpcalc.org/details.php?id=240. Since this application keeps track of how much correction has been made since the "reference time", one can easily modify it to make the corrections at frequencies other than once per day, or skip a correction, or add a program to make a correction immediately. What's more, one can easily extract the "accuracy factor" to apply to timings made between corrections.

But suit yourself; I don't doubt that your method works well enough.

Quote:
Currently KORR = 8017 for my 48GX.
So your 48SX's time is correct about once per day. It seems to me that at some time every day, it's inaccurate by at least .489 second.

I note that an "accuracy factor" (to apply to timings made between corrections) for your system would be '(24*60*60*8192+KORR)/24*60*60*8192', or '(707788800+KORR)/707788800'.

Note that the above applies to the 48 series and 49G, but the ARM-based models (49g+, 48gII, and 50g) have additional problems with time-keeping, because the processor's built-in real-time clock doesn't provide any signal that's an integer multiple of 8192 Hz.

Regards,
James


[ Return to Index | Top of Index ]

Go back to the main exhibit hall