60Hz timebase clock


Results 1 to 8 of 8

Threaded View

  1. #6
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: 60Hz timebase clock

    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
    Last edited by astouffer; - 15th January 2014 at 04:22.

Similar Threads

  1. Replies: 14
    Last Post: - 8th March 2012, 03:04
  2. external clock / internal clock
    By grounded in forum General
    Replies: 4
    Last Post: - 31st May 2008, 18:44
  3. Clock
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st February 2008, 03:23
  4. Power line timebase
    By Michael in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 6th March 2007, 17:13
  5. Xin & Xout Europe (50hz) vs US (60hz)
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd May 2005, 12:49

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts