How best to time a pin state for extended periods of time


Results 1 to 6 of 6

Threaded View

  1. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: How best to time a pin state for extended periods of time

    If Time accuracy is not an issue then a simple routine like this should solve the problem:

    Code:
    Counter  Var WORD
    
    Main:
    
    IF Pin_1 = 0 then
    PAUSE 1000  ' one second delay
    Counter = Counter + 1
    IF Counter >1800 then Output_3 = 1
    ENDIF
    
    IF Pin_1 = 1  and Counter > 1 then
    IF Counter <= 120 then Output_1 = 1
    IF Counter >120 and Conter <= 1200 then Outpt_2 = 1
    IF Counter >1200 then Output_3 = 1
    Counter = 0
    ENDIF
    
    
    GOTO Main
    All the time your Pin_1 will go to zero the time check will be activated.

    Cheers

    Al.
    Last edited by aratti; - 10th March 2011 at 06:48.
    All progress began with an idea

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