I have FXCPU PLC FX3G series and I create ST Structured Project in GX Works 2. The problem is I cannot loop through an array of bits. Here are my local variables.
Now this code in a program compiles with error
(* Do not compile! *)
FOR iCount := 0 TO 2 DO
arOfBits[iCount] := TRUE;
END_FOR;
But this code works fine
(* Compile *)
arOfBits[1] := TRUE;
The compile error as follows
No.: 1
Result: Error
Data Name: POU_01
Class: Program compile
Content: An invalid device OR an invalid constant is being used
Error Code: F0137
If that would be array of Words that would work fine in both examples. If it would be array of STRUCT
where one property there is bit
and another is WORD
, then both examples would work with WORD
but only the last example with bit
.
The nature of the problem is that if I use Device like D100 or variable as is in example I cannot access bits but only words. To access bits, I have to use constant as array index.
Does anyone know how to address this issue?