r.zarei2010
Member
Hi. I'm writing an CODESYS program with ST.
In diffrent parts of my main program i need my program to pause for a while and continue running after a time elapsed. So i defined Wait function block as below and reused it where it's need (multiple times):
delectation part:
FUNCTION_BLOCK Wait
VAR_INPUT
time_in:TIME;
END_VAR
VAR
ton1:TON;
END_VAR
----------------------------------
body part:
ton1(in:=TRUE,PT:=time_in);
WHILE ton1.Q=FALSE DO
ton1(PT:=time_in);
END_WHILE
ton1(in:=FALSE);
The function block works as expected, but is consume cpu very much, and watchdog stops my program.
what is the alternative way of doing this?
all i want is some thing like this:
Line 1
Line 2
Wait 5 seconds
Line 4
Wait 10 seconds
Line 6
...
Thanks.
In diffrent parts of my main program i need my program to pause for a while and continue running after a time elapsed. So i defined Wait function block as below and reused it where it's need (multiple times):
delectation part:
FUNCTION_BLOCK Wait
VAR_INPUT
time_in:TIME;
END_VAR
VAR
ton1:TON;
END_VAR
----------------------------------
body part:
ton1(in:=TRUE,PT:=time_in);
WHILE ton1.Q=FALSE DO
ton1(PT:=time_in);
END_WHILE
ton1(in:=FALSE);
The function block works as expected, but is consume cpu very much, and watchdog stops my program.
what is the alternative way of doing this?
all i want is some thing like this:
Line 1
Line 2
Wait 5 seconds
Line 4
Wait 10 seconds
Line 6
...
Thanks.