【发布时间】:2023-02-05 21:42:21
【问题描述】:
我试图在一个数组中创建一个定时循环,但我发现有些东西不正常,所以我回到了一个更简单的例子。现在我发现我的循环一直跳过 1 个索引并放置一个值。所以我只得到 index0、index1、index3 的值。我不明白为什么会这样,我会展示我的代码。
FOR vCount := 0 TO 9 DO
vVsample[vCount] := INT_TO_REAL(WORD_TO_INT(vVin));
vCount := vCount +1;
END_FOR
结果将是:
vVsample[0] = value vVin
vVsample[1] = did not change the value and is therefore 0
vVsample[2] = value vVin
vVsample[3] = did not change the value and is therefore 0
vVsample[4] = vVin
等到 vCount = 10
我正在使用 Codesys V2.3 并在模拟模式下对此进行了测试
【问题讨论】: