Timer SubRoutine


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Timer SubRoutine

    If you don't want to create your own timer. You could use DT's "Elapsed Timer" include . Then monitor the minutes like towlerg suggested.

    http://www.picbasic.co.uk/forum/show...light=dt+timer

    Maybe like this?
    Code:
        Include "Elapsed.pbp"
        Ticks    var byte   ' 1/100th of a second
        Seconds  var byte   ' 0-59
        Minutes  var byte   ' 0-59
        Hours    var byte   ' 0-23
        Days     var word   ' 0-65535
    
    
        Gosub ResetTime    ' Reset Time to  0d-00:00:00.00
        Gosub StartTimer   ' Start the Elapsed Timer
    
    
    MainLoop:
    
    Read ADC
    
     If minutes =0 then 
       Relay on
     	endif
     If minutes =1 then
       	Relay off
     		endif
     If minutes = 6 then
     	Gosub ResetTime 'Reset to 0 minutes
                		endif
    
    MainLoop
    Last edited by mark_s; - 12th September 2016 at 20:20.

Similar Threads

  1. Subroutine placement - must they come first?
    By BrianT in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 28th August 2012, 12:10
  2. Pulsin within subroutine
    By Wesley in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 10th January 2009, 23:05
  3. subroutine with hserin
    By volcane in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 19th December 2007, 02:56
  4. subroutine question
    By maus in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th September 2006, 21:36
  5. subroutine for picbasic
    By jojokatada in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2005, 18:58

Members who have read this thread : 1

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