Elapsed Timer Demo


Closed Thread
Results 1 to 40 of 112

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    Jim,

    I think that'll just flash it once at the 15 minute point.

    This should work.
    Code:
     Flashing VAR BIT
    
       IF MinutesChanged THEN
            MinutesChanged = 0
            IF Minutes = 15 THEN Flashing = 1
            IF Minutes = 20 THEN
                Flashing = 0
                HPWM 1, 0 , 30000
                POWER = 0
                LEDS = 0
                CURRENT = 0
            ENDIF
        ENDIF
    
        IF Flashing THEN
            SELECT CASE Ticks
              CASE IS <25 : HIGH LED
              CASE IS <50 : LOW  LED
              CASE IS <75 : HIGH LED
              CASE ELSE   : LOW  LED
            END SELECT
        ENDIF
    
    Last edited by Darrel Taylor; - 26th April 2012 at 23:08.
    DT

  2. #2
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    Darrel, can this be used as a countdown timer with the time left updated each second and displayed on a LCD?

    Thanks.

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


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    It Can ...

    But you would need to create the count down routine.
    The demo only counts up.
    DT

  4. #4
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    OK thanks. I will play around with it and see what mess I can create.

  5. #5
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    Ticks = Ticks + 1
    if Ticks = 100 then
    Ticks = Ticks-100
    Seconds = Seconds - 1
    SecondsChanged = 1
    if Seconds = 0 then
    Minutes = Minutes - 1
    MinutesChanged = 1 Seconds = 59
    endif

    if Minutes = 0 then
    Hours = Hours - 1
    HoursChanged = 1 Minutes = 59
    endif

    if Hours = 0 then
    Days = Days - 1
    DaysChanged = 1 Hours = 23
    endif
    endif

    To my untrained eyes, this would count down the time at every 100 ticks. I guess the issue, if this works, is how to preloaded the timer with the required start time and how to get it to stop at 0.

  6. #6
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    Seem to be having an issue I cant resolve. I've only use the timer software on a 18F2550 and it worked perfectly. I'm now using a 18F1320 and I've ran into an issue when compiling.

    ERROR Line 23: Redefinition of VAR. (DT_INTS-18.bas)
    ERROR Line 24: Redefinition of VAR. (DT_INTS-18.bas)
    ERROR Line 25: Redefinition of VAR. (DT_INTS-18.bas)

    Which are these lines in the code:

    Code:
    wsave       var byte  BANKA  SYSTEM   ' location for WREG
    ssave       var byte  BANK0  SYSTEM   ' location for STATUS register
    bsave       var byte  BANK0  SYSTEM   ' location for BSR register
    I am unsure as to what the problem is and where to start.

    I'm using PBP 2.60A and MCS 3.0.0.5

  7. #7
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    Fixed the above issue.

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 23:14
  2. Get elapsed time while TIMER samples pulses
    By RodSTAR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th March 2009, 17:27
  3. Elapsed Timer Demo in a PIC12F675
    By Leonardo in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 21st November 2008, 01:01
  4. Totally Baffled with Elapsed Timer
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th June 2008, 22:01
  5. Darrel Taylor Elapsed Timer
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th March 2008, 02:22

Members who have read this thread : 6

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