Elapsed Timer Demo


Closed Thread
Results 1 to 40 of 112

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    I have given this a good reading over but some of it has gone straight over my head.
    I intend to built a control unit based around a 16F877 which will include menu's to control output pins on the PIC, Obviously within the menu there will likely be instructions which will keep the processor busy for a few Ms at a time. My project ideas originally were to include an external clock device such as the DS1307 or the DS1603 to keep track of time whilst the rest of the program (Menu's etc etc) is running and keeping the processor busy.
    I was advised on this forum to look at this thread and if this is what I think it is then it will be truly fantastic for my project.

    My problem is that when the PIC returns from a menu I want it to display the time on the LCD. Am I right in what I have read in thinking (Besides setting LCD pins & oscillator etc) I can simply include all of the attached files in post number 1 of this thread but modify the 'loop' subroutine within "Test_Elapsed_LCD.pbp" file, to include my menu software?

    I understand that this thread creates a time elasped counter and not a clock, but I do have in mind ideas to include buttons with which I can set the hours, minutes & seconds. I will also miss out the displaying of 'Days' when it comes to print on the LCD.

    Apologies for what might seem to be a simple question to you guys but I have only been playing for a couple of months with PIC's and I am trying to learn from other people's examples.

    Thanks.

    hackableFM.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by hackableFM View Post
    I intend to built a control unit based around a 16F877 which will include menu's to control output pins on the PIC, Obviously within the menu there will likely be instructions which will keep the processor busy for a few Ms at a time. My project ideas originally were to include an external clock device such as the DS1307 or the DS1603 to keep track of time whilst the rest of the program (Menu's etc etc) is running and keeping the processor busy.
    I was advised on this forum to look at this thread and if this is what I think it is then it will be truly fantastic for my project. ...
    It can do the things you are suggesting.

    But it's not a replacement for a battery backed-up RTC chip.
    Any RESET will lose the accumulated time.

    I have used it as a clock running on-chip, but on power-up it reads the time from an RTC. That way it doesn't have to continuously read the time via I2C and it's always available from the internal time clock.
    <br>
    DT

  3. #3
    Join Date
    Feb 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Thank you, This sounds good so I'll have a bit more of a read up on it, I'll try to understand more about how it works before I go building anything.

    Battery backed is not an issue, this will be connected to a permanent 12v system within a caravan and therefore never likely to loose the accumulated time.

    hackableFM...

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


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    Hi Darrel,

    I'm trying to create a timer - a run time timer that will turn off an output after 30 minutes. Would this code work for such a task?

    Thanks

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


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    Sure, it'll do that really easy.

    Code:
    IF MinutesChanged THEN
        MinutesChanged = 0
        IF Minutes = 30 THEN
            ; turn off whatever it is here
            GOSUB ResetTime
        ENDIF
    ENDIF
    DT

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


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    Excellent!

    Can it do incremental too? As in can it be started and stopped during the 30 minute period?

    Also I need it to run when an output is on, but if the output is only on say 20 minutes then off for say an hour, I dont want it to only run for 10 minutes if the output is turned on again. What this timer is actually doing is stopping high power LED's getting hot due to excessive run time.

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


    Did you find this post helpful? Yes | No

    Default Re: Elapsed Timer Demo

    The Elapsed Timer can be Stopped and Started, like a stopwatch.
    Code:
     GOSUB StopTimer
     GOSUB ResetTime
     GOSUB StartTimer
    You can time things any which way you need to.
    DT

Similar Threads

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

Members who have read this thread : 4

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