Help with realtime clock and timer


Results 1 to 21 of 21

Threaded View

  1. #13
    geselaw's Avatar
    geselaw Guest


    Did you find this post helpful? Yes | No

    Default

    As you could see in my program("@ device intrc_osc_noclkout" and "PCON.3=1") , I am using the built-in 4MHz internal OSC .The one you see on the schematic was the one that I used for the real time clock on Tmr1 (32.768khz). You will find below the device setup that I used for quick reference.

    Could you please tell me those errors that you saw in the schematic ? I some times have second thought about mixing the digital circuit with the main power (ACS108). I found an error in the schematic and corrected it.The collector part of the phototransistor was connected to the Gnd. It should have been connected to the +ve.The new schematic is attached.

    DEFINE INTHAND myint
    @ device intrc_osc_noclkout
    @ device wdt_off
    @ device lvp_off
    @ device pwrt_on
    @ device cpd_off
    @ device bod_off
    @ device mclr_off
    @ device PROTECT_OFF

    ' **************
    ' *Device setup*
    ' **************
    PIE1.6 = 0 'disable the comparator before mesing with cmcon & vrcon
    VRCON = %10001011 'Voltage Refernece enabled and voltage = 2.97
    pause 10 'for stabiliazing
    CMCON = %10000101 'Single comparator enabled RA0 & RA3 are free for I/O
    PAUSE 10
    PIR1.6 = 0 'clear residing interrupt flag
    PIE1.6 = 1 'enable comparator flag
    pcon.3=1 '1=Internal oscillator 4mhz ,0=37khz
    T1con =%00001111 ' Turn on Timer1 with prescaler = 1
    Pir1.0 = 0 'disable comp & timr1 int flag
    trisb = %00000001
    trisa = %10100110 'PortA 1&2 are analog input ,the rest are digital I/O
    PIE1.0 = 1 ' Enable TMR1 overflow and Comparator interrupt
    INTCON = %11010000 ' Enable global ,peripheral , external interrupts
    Attached Images Attached Images  
    Last edited by geselaw; - 5th October 2005 at 16:17. Reason: Add

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. Clock with timer interrupt0
    By boban in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 4th November 2009, 14:59
  3. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 08:42
  4. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  5. clock and date without using real timer
    By eepro in forum Off Topic
    Replies: 1
    Last Post: - 21st September 2008, 02:38

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