I have an INT and TON defined
VAR
state : INT := 0;
timer_on : TON;
END_VAR
Now. The program is like this
IF (state = 0) THEN
timer_on(IN := TRUE, PT := T#5s);
IF (timer_on.Q = TRUE) THEN
timer_on.IN := FALSE;
state := 1;
END_IF
END_IF
When it is executed state is changed to 0 after 5 seconds. That's ok. But when I change state back to 0 it immediately goes back to 1. According to the documentation
Q is TRUE when IN is TRUE and ET is equal to PT. Otherwise it is FALSE.
In my case, after 5 seconds Q is always TRUE even when IN is FALSE