Elapsed Timer findings


Results 1 to 40 of 41

Threaded View

  1. #1
    Join Date
    Aug 2003
    Posts
    985

    Default Elapsed Timer findings

    Hi Guys,

    I finally figured out how the constant timer values are calculated for various oscillator speeds in DT’s Elapsed Timer.

    Code:
      IF OSC == 4                       ; Constants for 100hz interrupt from Timer1
    TimerConst = 0D8F7h                 ; Executed at compile time only
      EndIF
      If OSC == 8
    TimerConst = 0B1E7h
      EndIF
      If OSC == 10
    TimerConst = 09E5Fh
      EndIF
      If OSC == 20
    TimerConst = 03CB7h
      EndIF
    For the 20MHz example where the constant is 03B7h, it's the reverse of this:

    FFFFh - 03B7h = C348h (49992 decimal),
    49992 + 8 = 50000 (it must take eight instruction cycles to reload the timer)
    50000 / 10000 = 5
    5 x 4 = 20MHz

    I was looking for this:
    Code:
      If OSC == 16
    TimerConst = 063C7h
      EndIF

    Apologies if this info is already out there.
    Cheers, Art.
    Last edited by Art; - 30th March 2015 at 05:36.

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. SPWM and Elapsed Timer
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 8th May 2008, 03:16
  3. Darrel Taylor Elapsed Timer
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th March 2008, 01:22
  4. DT Elapsed Timer
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 9th March 2008, 23:17

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