Hi,
I have a question regarding the implementation of a timer in ST code in Mervis.
I have written the below code to set B := 10 after 10s since A becomes bigger than 5 and stays bigger than 5.
However, it does not work properly. It sometimes set B := 10 after more than 15s since A>5.
I appreciate any help.
VAR
A,B: bool;
MyTON: TON;
END_VAR
IF A>5 THEN MyTON(IN := not MyTON.Q, PT := T#10s);
END_IF;
IF A>5 AND MyTON.Q THEN B := 10;
END_IF;
I have a question regarding the implementation of a timer in ST code in Mervis.
I have written the below code to set B := 10 after 10s since A becomes bigger than 5 and stays bigger than 5.
However, it does not work properly. It sometimes set B := 10 after more than 15s since A>5.
I appreciate any help.
VAR
A,B: bool;
MyTON: TON;
END_VAR
IF A>5 THEN MyTON(IN := not MyTON.Q, PT := T#10s);
END_IF;
IF A>5 AND MyTON.Q THEN B := 10;
END_IF;