QUASAR PROJECT KIT # 3073 - 12/24 HOUR GIANT CLOCK
This project was originally published in the electronics
magazine,
Silicon Chip
, a few years ago. It is issued
here as a kit with permission. Some modifications to
the original published circuit and software have been
made and are are mentioned at the end of the
documentation.
The Big PIC Clock is based on a PIC16F84
microcontroller (uC.) The software in the uC allows for
very accurate timekeeping. For visibility at a distance it
uses 2.3”/57mm super large, hi-efficiency red LED
displays for the hours and minutes and smaller 0.56”
LED displays for the seconds. The circuit incorporates
a dimming feature so that at night the reduced ambient
light is sensed and the display is dimmed. Before we
construct the clock please read through the following
theory about clock adjustment and setting and the
general circuit description.
Accuracy Theory and Adjustment.
The clock may be
adjusted for very good long-term accuracy. All crystal-
based clocks have a tendency to run fast or slow. Some
use a trimmer on the crystal for adjustment but they
will still drift due to temperature changes over time.
However, in this design an accurate adjustment feature
has been built into the software. Carefully adjusted you
should be able to get the clock to keep time to within a
few seconds a year. The adjustment technique requires
you to correctly set the clock and wait a few days to
see how accurate it is. Then an adjustment mode is
selected and the number of seconds the clock differs
from the correct time calculated over a period of 60
days is entered in.
However, it is not necessary to wait 60 days. In the
beginning a day or so is long enough to get a good idea
how fast or slow the clock is running. The only
requirement is that you calculate the number of
seconds it would gain or lose in 60 days. Of course the
more days you wait the greater the accuracy of the
adjustment
After entering the adjustment figure the clock then
maintains time by slightly adjusting the length of a
second every so often. If the crystal was running slow
then there will be an occasional shorter second
(999msec) to speed up the clock. Conversely, if the
clock was running fast there will be an occasional
longer second (1.001 sec) to slow it down.
In software the adjustment figure of seconds per 60
days is divided by 10,368 to obtain a reference counter
value. For example, if the adjustment figure is 60 (1
second per day) then the reference value will be
10,368/60 or 172. This value is compared with a
second counter which is increased once every
500msec. When the second counter value reaches the
value of the reference counter, the second counter is
altered by 1msec. The second counter is then reset to
count up again.
For our example value, the second counter will reach
172 after 500 x 172msec, or 86,400msec. Therefore, a
correction of 1msec is made every 86,400 msec which
is equal to 1 second per day. Thus there will be 1000
corrections per day. (One day has 86,400 seconds.)
The number of seconds per 60 days adjustment figure
requires a positive or negative sign to indicate whether
the clock needs to use slow seconds or long seconds. A
minus means the clock is slow and needs speeding up.
A plus (no sign) means the clock is fast and will need
to be slowed. The adjustment range is from 0 to –255
and from 0 to 255 seconds per 60 days with 1 second
per 60 days resolution. This corresponds to 0ppm
through to +/-50ppm adjustment with just under
0.2ppm steps.
The time adjustment is initiated by pressing both the
hatkey switches (one is for hour adjustment and the
other for minutes) simultaneously. The seconds display
will show an ‘Ad’. Upon release the current adjustment
figure will be shown. You can increase it by pressing
the hour switch and decrease it by pressing the minute
switch. If the number goes below zero the minus sign
will appear and these
negative
numbers are used when
the clock is running
slow
. The
positive
numbers are for
fast
clocks.
Press both switches simultaneously to return to the
clock. The time will need to be reset correctly. The
adjustment number is stored in memory and will be
retained unless changed by entering the ‘Ad’ mode
again and changing.
Example: if you find the clock is 1 second fast every
60 days you need to add +1 to the current adjustment
figure. Thus if the current adjustment figure is –
35sec/60 day correction then it must be changed to –
34. Or if the current value was 38 then it must be
increased to 39.
Clock Setting.
Use the minutes switch to go to the
correct hour and minute with the seconds at ‘00’ You
just wait until a reference clock (TV, radio) begins the
next minute. Pressing the minute switch will go to the
next minute, reset the seconds to ‘00’ and thus enable
the clock to be set accurately to about 1/10
th
second.
Daylight Saving.
This is easy to do and non-
disruptive. To advance the clock just press the hour
switch once. To retard the clock one hour just press it
23 times. That is, keep it depressed until the previous
hour comes up. In both cases the minutes and seconds
are unaffected.
12 or 24 Hour Display.
You may toggle between each
display mode by depressing the hour switch when you
apply power. In 12 hour mode am or pm (your
decision) is indicated by the decimal point LED of the
leftmost display coming on. On initial power-up the
clock is in 24 hour mode.
Dimming.
This is under software control. The duty
cycle for the multiplexed signals to all 6 displays is
varied. In a multiplexed display only one digit is on at
any one time but the displays are cycled on/off at such
Summary of Contents for 3073
Page 5: ......