I want to put the variable D1, for example, instead of the number 1 in this code
The program does not accept this
MOV D100 Ary[1]
The program does not accept this MOV D100 Ary[D1]
I tried a lot and did not succeed. I will be grateful to you for your help
In ISPSoft User Manual, item 6.1.5:
In ISPSoft, a symbol can be modified by an index register (...) The same rule applies to a symbol whose data type is ARRAY. The format is
Identifier[Index]@Index register
. Theindex
must be a constant. If the index is a symbol, the symbol whose data type is ARRAY cannot be modified by the index register (...)
In the figure below, Ary is an array composed of five elements, and the start device address is
D200
. When the system compiles the program,D200~D204
are assigned Ary. If the value in the index registerE0
is2
,Ary[0]@E0
indicates that2
is added to the device address (D200
) assigned toAry[0]
, that is,Ary[0]@E0
representsD202
, the device address assigned toAry[2]
. If the value in the index registerE0
is6
,Ary[0]@E0
representsD206
.D206
is not within the range of devices assigned to the array, but this usage is legal. (...)
Note that the method depends on the PLC model, there are some that do not support the use of index, you can check in the manual.