Hi,
How about this:
Code:
Relay var PortA.0 'Relay connected to PortA.0
Latch var bit
ON CON 1 'Constant for relay ON
OFF CON 0 'Constant for realy OFF
Latch = 0
Start:
If Value2 >= P5 then Latch = 1 'Remember that Value2 has exceeded limit
If (Vout >= P3) OR (Latch = 1) then 'Relay ON if Vout is over limit OR Value2 is or have been.
Relay = ON
ELSE
Relay = OFF
EndIf
Pause 1000
Goto Start
Once Value2 is bigger than (or equal to) P5 the relay will turn ON and stay ON forever. Otherwise the state of the relay depends on Vout.
/Henrik Olsson.
Bookmarks