FUNCTION FC53: VOID // MAN CUT MODE SUB FUNCTION 513 TO 412 //
VAR_TEMP
Y1 : INT;
Y2 : INT;
Y3 : INT;
I_FOR : INT;
END_VAR
VAR_INPUT
X1, X2, X3, X4 : INT; // X1:out LLOOP; X2:out SLOOP; X3:in LLOOP; X4:in SLOOP; //
END_VAR
Y1:= DB30.WANT_CUT_NUM;
Y2:=X1+Y1-1;
IF Y2>5 THEN Y2:=Y2-5; END_IF;
IF DB30.STATE=5 AND DB30.LLOOP=Y2 AND DB30.SLOOP=X2 AND DB30.V513_V412=TRUE THEN//CUT OUT
FOR I_FOR:=1 TO 30 BY 1 DO
DB30.VALVES_TEMP2[I_FOR] :=FALSE;
END_FOR;
DB30.LLOOP :=X3; DB30.SLOOP :=X4; //CUT IN
DB30.V513_V412:=FALSE; DB30.V412_V513:=FALSE;
DB30.STATE:=4;
DB30.V412:=TRUE;
DB30.V513:=FALSE;
DB30.V513_V412:=FALSE;
DB30.CUTTED_NUM:=DB30.WANT_CUT_NUM;
DB30.WANT_CUT_NUM:=0;
M61.0:=0;
END_IF;
END_FUNCTION
其中的: FOR I_FOR:=1 TO 30 BY 1 DO
DB30.VALVES_TEMP2[I_FOR] :=FALSE;
END_FOR;
这个循环语句是什么意思啊,C中有学过,忘记了,好像还有点不一样呢,大哥大嫂,给俺讲讲吧
最佳答案
和前一个问题一样,这个循环就是将数组中的30个位(DB30.VALVES_TEMP2[1]~DB30.VALVES_TEMP2[30])清0用的
提问者对于答案的评价:
TS
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc302852.html