No problem Sheldon apart from me being a perfectionist of course. There are some parts of the code that are hard for me to follow, which has set me thinking.
This
Code:
if Event1_OT_Day = 0 and Event1_OT_hour = 0 and Event1_OT_Min = 0 and _ ' if all values are 0 , then dont enable the overrun timer
Event1_OT_sec = 0 and Event1_OT_100th = 0 then
EL2_Enable = 0 ' Disable El2 Counter
EL2_Allow = 0 ' clear Flag so EL4 wont start
else
EL2_Allow = 1 ' Event1 setting Higher than 0 so allow EL4 to be enabled if Event2 settings are higher than 0
endif
is easier to read like this
Code:
if Event1_OT_Day = 0 and _
Event1_OT_hour = 0 and _
Event1_OT_Min = 0 and _ ' if all values are 0 , then dont enable the overrun timer
Event1_OT_sec = 0 and _
Event1_OT_100th = 0 then
EL2_Enable = 0 ' Disable El2 Counter
EL2_Allow = 0 ' clear Flag so EL4 wont start
else
EL2_Allow = 1 ' Event1 setting Higher than 0 so allow EL4 to be enabled if Event2 settings are higher than 0
endif
you could also do something like
Code:
EL2_Allow = Event1_OT_Day + _
Event1_OT_hour + _
Event1_OT_Min + _ ' if all values are 0 , then don't enable the overrun timer
Event1_OT_sec + _
Event1_OT_100th
if EL2_Allow = 0 then EL2_Enable = 0 ' Disable El2 Counter
Just thoughts that need testing out. I am wondering if bitwise comparators could be used in the last version. Could also possibly have
Code:
EL2_Enable = Event1_OT_Day + _
Event1_OT_hour + _
Event1_OT_Min + _ ' if all values are 0 , then don't enable the overrun timer
Event1_OT_sec + _
Event1_OT_100th
Would that work?
Bookmarks