How can I set a variable to specify ARRAY in ispsoft

152 views Asked by At

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

1

There are 1 answers

4
dwpessoa On BEST ANSWER

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. The index must be a constant. If the index is a symbol, the symbol whose data type is ARRAY cannot be modified by the index register (...)

enter image description here

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 register E0 is 2, Ary[0]@E0 indicates that 2 is added to the device address (D200) assigned to Ary[0], that is, Ary[0]@E0 represents D202, the device address assigned to Ary[2]. If the value in the index register E0 is 6, Ary[0]@E0 represents D206. 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.