The following compiles, but I'm not able to test yet as I'm waiting for a 20 x 4 LCD
Code: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[fn]=1 ; is it past the Stop time? if (timeH>lightoffHR[fn]) OR _ (timeH=lightoffHR[fn] AND timeM>lightoffMN[fn])then PastStop[fn]=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[fn]=1 ' endif ;--------------- if !NextDay then ; same day, use AND if PastStart[fn] AND !PastStop[fn] then ProgON = 1 else ; next day, use OR IF PastStart[fn] OR !PastStop[fn] then ProgON = 1 endif if fn=0 and ProgON=1 then Lights1 = 1 LCDOut $FE, $94+9,"Lights ON" if fn=1 and ProgOn=1 then Lights2 = 1 'turn on those light LCDOut $FE, $94+9,"Lights ON" AlwaysOFF: Lights1 = 0 Lights2 = 0 'turn off the light if lights1 = 0 and lights2 = 0 then LCDOut $FE, $94+9," " endif return




Bookmarks