Hi all,I'm still learning the ropes using ST in Codesys; I am trying to use two timers that repeat until a condition becomes false. I have declared each Timer as a TON variable. Here is my code:
IF TestFlag = TRUE THEN
TimerOne (IN:= TimerOneTrigger,PT:= TIME#1000MS);
IF TimerOne.Q THEN
TimerOneTrigger:= FALSE;
TimerTwoTrigger:= TRUE;
END_IF
TimerTwo (IN:= TimerTwoTrigger,PT:= TIME#2000MS);
IF TimerTwo.Q THEN
TimerOneTrigger:= TRUE;
TimerTwoTrigger:= FALSE;
END_IF
END_IF
TimerOneTrigger is mapped to a button in my visulization. Running this code only runs each timer once. What am I missing to allow this to keep runing until my TestFlag variable becomes false?
Thanks
IF TestFlag = TRUE THEN
TimerOne (IN:= TimerOneTrigger,PT:= TIME#1000MS);
IF TimerOne.Q THEN
TimerOneTrigger:= FALSE;
TimerTwoTrigger:= TRUE;
END_IF
TimerTwo (IN:= TimerTwoTrigger,PT:= TIME#2000MS);
IF TimerTwo.Q THEN
TimerOneTrigger:= TRUE;
TimerTwoTrigger:= FALSE;
END_IF
END_IF
TimerOneTrigger is mapped to a button in my visulization. Running this code only runs each timer once. What am I missing to allow this to keep runing until my TestFlag variable becomes false?
Thanks