I want to increment a counter by 1 only after a tank has filled to the high level H_lvl and empties below the L_lvl.
'When tank is full set Port 3 and Flag 3 to 1 to energize dump valve
If L_lvl > 0 AND H_lvl > 0 Then
PortSet (3,1 )
Flag(3) = 1
EndIf
'When tank is empty de-energize Dump valve
If L_lvl = 0 Then
PortSet (3,0 )
Flag(3) = 0
EndIf
Port 3 and Flag(3) clear as expected when the tank is empty
'When tank is empty de-energize valve relay
If L_lvl = 0 AND Flag(3) = 1 Then
PortSet (3,0 )
Flag(3) = 0
EndIf
Port 3 and Flag(3) do not toggle as expected
I would review the code and ensure that these two conditions are True at the same time when the expression is evaluated.
If L_lvl = 0 AND Flag(3) = 1 Then
I am assuming that L_lvl is a measurement/variable being read, but how is Flag(3) set? That is where I would start troubleshooting.
Dana W.
Thank you