plc latching function example - Search