Amoque: Using the 60Hz power for a source will give me more accuracy than an RTC chip and be cheaper. I actually built a large clock based on the link you posted. It worked great but requires long term tweaking for accuracy. Even a 20ppm crystal it still gained a minute or two every month. Here is me testing one of the digits
This code runs on a 16F684 and blinks an LED on pin 10 at 1Hz when fed a 60Hz input on pin 11. Of course the final version will be doing much more than blinking an led. I plan to use four IV-9 numitron tubes for the digits. http://hackadaycom.files.wordpress.c...2/numitron.jpg
Code:
@ __CONFIG _FOSC_INTOSCIO & _WDTE_OFF & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOD_OFF & _BOREN_OFF & _IESO_OFF & _FCMEN_OFF
OSCCON = %01110101 'Internal OSC 8MHz
DEFINE OSC 8 '8MHz
PORTA = 0 'All low
TRISA = %00000100 'Porta.2 input
ANSEL = 0 'No analog
WPUA = 0 'Weak pull up off
CMCON0 = %00000111 'Comparators off and I/O is digital
ADCON0 = 0 'A/D is off
CCP1CON = 0 'PWM and CCP off
OPTION_REG = %11111000 'Timer0 on
TMR0 = 195 'Preload so it rolls over on the 60th pulse
INTCON = %11100000 'INTCON.2 overflow bit
on interrupt goto blink
main:
@ NOP
goto main
disable
blink:
toggle portc.0
TMR0=195
INTCON.2 = 0
resume
enable
end
Almost forgot the basic schematic. Use a scope to see what resistor values give you the best output. My meter read 3mA going into a 4N25 optic isolator. http://i.imgur.com/fHWGJHr.jpg
Bookmarks