If I didn't make it clear, a program can be:
Start 13:10:02
End 13:10:05
HH:MM:SS
If I didn't make it clear, a program can be:
Start 13:10:02
End 13:10:05
HH:MM:SS
All those little details help.
Here's another possibility.
Run it once per second. Probably a gosub from the clock's code.
Code:;--Start Time-- Start_Hours CON 13 Start_Minutes CON 10 Start_Seconds CON 2 ;--Stop Time-- Stop_Hours CON 13 Stop_Minutes CON 10 Stop_Seconds CON 5 ProgON VAR BIT ProgON = 0 ;--sub-- IF Hours = Start_Hours THEN IF Minutes = Start_Minutes THEN IF Seconds = Start_Seconds THEN ProgON = 1 ENDIF ENDIF ENDIF IF Hours = Stop_Hours THEN IF Minutes = Stop_Minutes THEN IF Seconds = Stop_Seconds THEN ProgON = 0 ENDIF ENDIF ENDIF
DT
Thanks,
The main risk is if for some reason you loose a check, then you have missed the program start time
how about using 2 loops depending on operating output,
if progon=1 then do turnoff checking ' "otherwise"
do turn on checking
'''
'''
'''
turnoff checking stuff
''''
turnon checking stuff
don
Calculating time from Midnight is not possible since it more than 16Bit.
Moreover, If start time is 13:00:00 and end time is 01:00:00 will be also a problem.
Maybe, checking the Seconds can be with > instead of =, since there is no chance that it will miss for more than few seconds.
Next time if the Program is already On the check will be passed.
Which is why I suggested only counting every other second above....
Or like DT said, you have another bit that'll signify AM or PM...
if time_of_day = 0 ' then it must be between 0000 and 1159Code:time_of_day var bit am con 0 pm con 1
if time_of_day = 1 ' then it must be between 1200 and 2359...
Or again, you can use a LONG variable type and use a 32 bit (ok, 31 plug a sign) variable type.
Bookmarks