Get elapsed time while TIMER samples pulses


Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    May 2007
    Posts
    65

    Wink Get elapsed time while TIMER samples pulses

    hi fellows,
    this is a shorter and clearer way to expose my question:

    Does any Interrupt or Timer variable let me capture elapsed time ?
    [modified code taken from mister_e post]
    Code:
    Start: 
        TMR1L=0                  ' Clear Counter
        TMR1H=0                  ' Clear Counter      
                                 ' 
        TMR1ON=1             ' START counter
          ...DO_THINGS       ' <----Do other things in unknown time while counting in background
          ...FOR..NEXT...LCDOUT.... ' ....things happen
          hserout pulseRATE 
        TMR1ON=0                 ' STOP counter
                                 '
        CounterA.HIGHBYTE=TMR1H  ' Get results                          
        CounterA.LOWBYTE=TMR1L   ' 
    
        LapTIME = ELAPSED_TIME   ' Get ms <---- Something like this is what I wish... does it exist?
        'so I can do the following:
        pulseRATE = CounterA / LapTIME '  this would be heaven... :) [pseudocode]
        'pulseRATE is the pulse rate in this cycle.
        '
        '  Blah blah blah
        '
    goto start

    The idea is to handle a sort of variable (LapTIME) that handles the elapsed time(ms) while TMR1ON=1 (between START and STOP). to make accurate calculations like pulse rate, speed.. (for quadrature encoders)

    well, that is it
    thanks for your time
    regards,

    RodSTAR
    Last edited by RodSTAR; - 16th October 2007 at 05:14.

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. Totally Baffled with Elapsed Timer
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th June 2008, 21:01
  3. Count pulses between VARIABLE TIME
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2007, 12:44
  4. Timing input pulses and re-outputting them
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th February 2007, 01:50
  5. Timer in real time
    By martarse in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th July 2005, 14:24

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