Darrel Taylor Elapsed Timer


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    74

    Question Darrel Taylor Elapsed Timer

    I've been through this before but I must be doing something wrong.
    My DT Elapsed Timer is incrementing the seconds every 15 seconds.

    I'm running a 18F4520 with an External clock of 20 MHZ

    I set T1CON = 0 'Main Clock FOSC/4, 1:1 Prescaler .....

    In the Elapsed_Int-18 code I verified the constant is 15543... for 100 interrupts per second.

    If OSC == 20
    TimerConst = 03CB7h
    EndIF

    What did I miss? Why am I running so slow.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hmmm ~15 seconds.

    I would guess that you are actually running on the internal oscillators default of 1mhz.

    If FCMEN (Fail-safe Clock Monitor) is enabled, and the external oscillator fails, it automatically switches over to the internal oscillator.
    <br>
    DT

  3. #3
    Join Date
    Oct 2005
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I'll double check that, but if that were the case, wouldn't my baud rates and stuff be off as well on my serial port stuff?

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Yes it would.
    Didn't realize you had serial working along with the problem.
    Thought maybe it was just an LCD, which wouldn't be affected.

    Do you have other interrupts in the program too?
    Something that might be keeping the interrupts locked up for too long?
    <br>
    DT

  5. #5
    Join Date
    Oct 2005
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Yes, I have one other that's for Rx but it grabs a short 8 byte serial string once every 2 seconds.

    INCLUDE "DT_INTS-18.bas" ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts
    INCLUDE "Elapsed_INT-18.bas" ; Elapsed Timer Routines

    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler RX_INT, _Receive, PBP, yes
    INT_Handler TMR1_INT, _ClockCount, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    @ INT_ENABLE RX_INT ; enable external (INT) interrupts
    @ INT_ENABLE TMR1_INT ; enable external (INT) interrupts


    15 seconds is a long time and is pretty consistient.

  6. #6
    Join Date
    Oct 2005
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I did check, and I do have the following fuses set in my programmer.

    Osc = HS, FSCM = on, Brown Out = Enabled,
    Low Power Timer1 Osc = Low Power ??? Was default

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  4. using darrel taylor's instant interrupts
    By Michael Wakileh in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 31st July 2007, 04:07
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

Members who have read this thread : 1

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