Time comparison


Results 1 to 21 of 21

Thread: Time comparison

Threaded View

  1. #13
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Darrel,

    Changed the code and it's still not functioning right.

    If I set the on time as 15:00 and off time as 15:01 the led comes on at 15:01 and stays on... well past the programmed stop time... any ideas ?

    Code:
    CheckTimes:
    TimeCmpFlags = 0  ; clear flags first
    
         ; if the Start and Stop times are the same, then Always OFF 
      if (lightsetHR[fn]=timeH) AND _       
         (lightsetMN[fn]=timeM) then AlwaysOFF                      
    
         ; is it past the Start time?
      if (timeH>lightsetHR[fn]) OR _              
         (timeH=lightsetHR[fn] AND timeM >= lightsetMN[fn])then PastStart=1
    
         ; is it past the Stop time?
      if (timeH>lightoffHR[fn]) OR _                
         (timeH=lightoffHR[fn] AND timeM >= lightoffMN[fn])then PastStop=1
    
         ; does the period end the following day?
      if (lightoffHR[fn]< lightsetHR[fn]) OR _           
         (lightoffHR[fn]=lightsetHR[fn] AND lightoffMN[fn] < lightsetMN[fn]) then NextDay=1
    
      if !NextDay then                               ; same day, use AND
          if PastStart AND !PastStop then ProgON = 1
      else                                           ; next day, use OR
          IF PastStart OR !PastStop then ProgON = 1
      endif
       
    AlwaysOFF:
    
    return
    Last edited by malc-c; - 27th July 2010 at 12:18. Reason: code added

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