Expanding Timer1 counting range


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Location
    Malaysia
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    Thanks for the guide. I have clearer idea now. Sorry for OVERDOING it. But at least Mr.Skimask and Mr.Acetronics is willing to help me out. Thanks.
    Last edited by sycluap; - 14th January 2008 at 04:32.

  2. #2
    Join Date
    Jan 2007
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Expanding Timer1 counting range

    Hello sycluap,
    In your code, where you have initiate time counting:

    Looping:
    While PIR1.0=0
    Wend


    It appears that you are allowing the timer1 to overflow and then checking to see if the button has been released. This leads me to assume that you don't care if the button is released during the time Timer1 takes to reach rollover.
    If this is the case, then is the use of Timer1 really necessary?
    If you don't need resolution under a uSec then you might consider using the PBP3 "pauseus" command to create the 1 uSec.
    1) Start button is pressed
    2) pauseus 1 (delay 1uSec)
    3) count0 = count0 + 1
    4) if count0 = 65535 then count1 = count1 + 1; count0 = 0
    5) check button ( if still pressed loop again)

    In this case, you can capture ( minimum 1 uSec - maximum 4294 seconds).
    For the math, just use count1 value as a multiplier of 65535
    So, then if count1 = 40 you have (65535*40) = 2.6214 seconds accumulated in count1
    and then you just add count0 value to that to get the total.


    for loop1 = 1 to count1
    for loop2 = 1 to 5
    micro_sec = micro_sec + 13107
    while micro_sec > 999
    milli_sec = milli_sec + 1
    micro_sec = micro_sec -1000
    wend
    while milli_sec > 999
    sec = sec + 1
    milli_sec = milli_sec - 1000
    wend
    next
    next
    Lcdout $fe, 1, #sec,":",#milli_sec,":",#micro_sec



Similar Threads

  1. Software PWM using Timer1
    By muqasim in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th December 2009, 11:49
  2. Help with TIMER1 + SLEEP
    By Yodoad in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd May 2009, 15:07
  3. Time Period of Timer1
    By arnol34 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th May 2007, 00:31
  4. continious counting process (capture)
    By asynch in forum General
    Replies: 1
    Last Post: - 17th February 2006, 07:42
  5. Timer1 and Interupt wierdness
    By mind in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 23rd August 2005, 01: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