PIC Digital Clock Timer

This clock timer uses a PIC16F628 microcontroller to display digital time and control an external load. Timer output duration can be programmed from 1 to 59 minutes and can be manually switched on and off.

The clock has a correction feature that allows an additional second to be added every so many hours to compensate for a slightly slow running oscillator. The oscillator uses a common 32.768 KHz watch crystal and the frequency can be adjusted slightly with the 24pF capacitor on the right side of the crystal. The clock will also adjust itself for daylight savings time and add or subtract an hour on the first Sunday in April and last Sunday in October. The daylight savings feature is disabled at bootup and needs to be enabled after turn on.

Setting the time of day and other features is done with 3 momentary single pole, double throw switches and one non-momentary single pole, double throw. The switch functions are shown in the chart below with the letters A-H indicating the switch combination for each function. Some entries can be made with one momentary switch closure while others reguire toggling 2 switches at the same time.

For example, to display the time of day, the switch combination A and C is used which indicates closing the momentary switch labeled C and D to the C position, and setting the non-momentary switch to the A position. Any entries requiring a numeric value such as the alarm duration are entered in the alarm minutes digits and then transfered to the desired entry with the appropriate switch combination. For example, to enter a alarm duration of 30 minutes, the number 30 is entered for alarm minutes and then switch combination ACH is used to set the duration to 30 minutes.

Function Switch Combination

Display Time AC
Display Alarm AD
Display Seconds AG
Set Time (Hours) ACF
Set Time (Minutes) ACE
Set Alarm (Hours) ADF
Set Alarm (Minutes) ADE
Blank Display AH
Toggle Alarm On AE
Toggle Alarm Off AF
Set Alarm Duration ACH – First enter duration in alarm minutes
and then use ACH.
Set Time Correction AFG – First enter correction in alarm minutes
and then use AFG. For example, to add
1 second every 20 hours, enter 20 into
alarm minutes and then switch AFG.

Enable Daylight Savings BCE
Zero Seconds AGE
Zero Alarm Minutes BD
Set Calendar Day Set the alarm so that minutes indicates
the number of weeks elapsed since last
correction and hours indicates the current
day of the week (1 to 7) Sunday = 1,
Saturday = 7. Then use switchs BG to
set the calendar.
Set Calendar Year Set the alarm so that minutes indicates
the number of elapsed 6 month periods
since 04/04/04. For example, January 8th, 2005
would be 1 and April, 4, 2005 would be 2.
Then use BH to enter the year position.

Display Alarm Duration and
Daylight Bit BC
Display Calendar Elapsed
Weeks and Days BE
Display Correction and
Calendar Year BF

Copyright 2006: [url=http://www.bowdenshobbycircuits.info]Bill Bowden[/url]

Leave a Reply

Your email address will not be published. Required fields are marked *