Elapsed Timer findings


Results 1 to 40 of 48

Threaded View

  1. #22
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer findings

    did you see this

    Code:
    '***************************************************************************
    '*  Name    : Elapsed_INT-18.bas                                           *
    '*  Author  : Darrel Taylor                                                *
    '*  Date    : JUL 11, 2006 : 7/11/2010                                     *
    '*  Version : 1.2                                                          *
    '*  Notes   : Must have DT_INTS-18.bas loaded first                        *
    '*   ver 1.2: Now works at any OSC frequency without using the prescaler   *
    '***************************************************************************

    the pic16 ver can work up to and including 32MHz without the need of a prescaler if necessary

    Code:
    '****************************************************************
    '*  Name    : Elapsed_INT.bas                                   *
    '*  Author  : Darrel Taylor                                     *
    '*  Date    : Jan 10, 2006                                      *
    '*  Notes   : Must have DT_INTS-??.bas loaded first             *
    '****************************************************************
    DISABLE DEBUG
    ; syntax =     Handler  IntSource,        Label, Type, ResetFlag?
    DEFINE  Elapsed_Handler  TMR1_INT,  _ClockCount,  PBP,  yes
    ; the above define can be used in the INT_LIST macro, if desired (optional)
    
    
    Ticks    var byte   ' 1/100th of a second
    Seconds  var byte
    Minutes  var byte
    Hours    var byte
    Days     var word
    
    
    SecondsChanged   var bit
    MinutesChanged   var bit
    HoursChanged     var bit
    DaysChanged      var bit
    SecondsChanged = 1
    MinutesChanged = 1
    
    
    Goto OverElapsed
    
    
    ' ------------------------------------------------------------------------------
    ' To calculate a constant for a different crystal frequency - see this web page
    ' http://www.picbasic.co.uk/forum/showthread.php?t=2031
    ' ------------------------------------------------------------------------------
    Asm
      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 == 16
    TimerConst = 063C7h
      EndIF
      If OSC == 20
    TimerConst = 03CB7h
      EndIF
      If OSC == 32
    TimerConst = 25539
      EndIF
    Last edited by richard; - 23rd August 2024 at 04:03.
    Warning I'm not a teacher

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 : 8

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