发表于:2022/10/21 17:01:01
#10楼
测试了几组数具 应该是满足你得要求了,从wGetUserData 输入要预设得顺序,完成后点击bLearning按钮后操作员可以开始输入数据,如果顺序错误bFault:=TRUE;
IF wGetUserData <>wGetUserDataOld THEN (*获取输入数*)
aListCache[indexList]:=wGetUserData;
indexList:=indexList+1;
END_IF;
IF NOT bLearning THEN
FOR index:=0 TO 8 DO
aListRequest[index]:=aListCache[index];
END_FOR;
ELSE
IF NOT bLearningOld THEN (*测试开始*)
indexList:=0;
FOR index:=0 TO 8 DO
aListCache[index]:=0;
END_FOR;
END_IF;
IF indexList >0 THEN (*至少输入一个数*)
IF aListRequest[indexList-1]<>aListCache[indexList-1] THEN
bFault:=TRUE;
aListRespond[indexList]:=aListCache[indexList];
END_IF;
END_IF;
END_IF;
bLearningOld:=bLearning;
wGetUserDataOld:=wGetUserData;
IF wGetUserData <>wGetUserDataOld THEN (*获取输入数*)
aListCache[indexList]:=wGetUserData;
indexList:=indexList+1;
END_IF;
IF NOT bLearning THEN
FOR index:=0 TO 8 DO
aListRequest[index]:=aListCache[index];
END_FOR;
ELSE
IF NOT bLearningOld THEN (*测试开始*)
indexList:=0;
FOR index:=0 TO 8 DO
aListCache[index]:=0;
END_FOR;
END_IF;
IF indexList >0 THEN (*至少输入一个数*)
IF aListRequest[indexList-1]<>aListCache[indexList-1] THEN
bFault:=TRUE;
aListRespond[indexList]:=aListCache[indexList];
END_IF;
END_IF;
END_IF;
bLearningOld:=bLearning;
wGetUserDataOld:=wGetUserData;
[此贴子已经被作者于2022/10/21 17:01:57编辑过]