Hi Paul,

Originally Posted by
paul borgmeier
Yours goes to ELSE only if Hours_Alarm_Set_Point =0 is not true, otherwise they go to ENDIF and out of the massive IF-THEN jungle
Your right on that point Paul, I re-thought it out and came up with this code below and it works......... thanks
Code:
' This saves 142 bytes
' ====================
F VAR BIT
F = 0
IF Seconds = 0 THEN F = 1
IF Minutes = 0 THEN F = 1
IF Hours = 0 THEN F = 1
IF Seconds_Alarm_Set_Point = 0 THEN F = 1
IF Minutes_Alarm_Set_Point = 0 THEN F = 1
IF Hours_Alarm_Set_Point = 0 then F = 1
IF F = 0 THEN
ELSE
IF Start_Stop_Mode = StartTime THEN
IF Hours = Hours_Alarm_Set_Point THEN
IF Minutes = Minutes_Alarm_Set_Point THEN
IF Seconds = Seconds_Alarm_Set_Point THEN
GOSUB StopTimer
LOW Clock_Active_Green_Led : Alarm_Is = On_
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF

Originally Posted by
Archilochus
Another way to do it that might work...
Since you're checking to see that all those variables = 0, you could just first add them all (making sure that the Temp variable size won't be exceeded), then just test the sum...
That's a really neat efficient approach Arch and its the one I'll use. I would have never thought of that way of doing it but now I'll never forget it, its one more tool in my tool box now! Thanks a lot guys, I really appreciate your input.
Code:
' This saves 182 bytes
' ====================
Temp = Seconds + Minutes + Hours + Seconds_Alarm_Set_Point + _
Minutes_Alarm_Set_Point + Hours_Alarm_Set_Point
IF Temp = 0 THEN
ELSE
IF Start_Stop_Mode = StartTime THEN
IF Hours = Hours_Alarm_Set_Point THEN
IF Minutes = Minutes_Alarm_Set_Point THEN
IF Seconds = Seconds_Alarm_Set_Point THEN
GOSUB StopTimer
LOW Clock_Active_Green_Led : Alarm_Is = On_
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
Thanks
jessey
Bookmarks