6 Programming
6-14
NJ-series CPU Unit Software User’s Manual (W501)
Array Specifications for Instances
Array specifications can be made for instances. You can indirectly specify an array element number
with a variable to execute multiple instances with one instance name. Furthermore, you can switch
input sources and output destinations and effectively execute multiple instances with a single
instance name if you use an array specification for the input parameter and output parameter and
specify the element numbers with the same variable.
Example:
FOR
Not Using an Array to Specify Instances Using an Array to Specify Instances
PT[0]
TON
PT ET
PT ET
PT ET
UINT#0 i
Initval
UINT#4
Endval
UINT#1
Stepval
Index
EN ENO
NEXT
EN
PT ET
PT ET
OUT[0]
timer0
IN[0]
PT[1]
TON
OUT[1]
timer1
IN[1]
PT[2]
TON
OUT[2]
timer2
IN[2]
PT[3]
TON
In Q
In Q
In Q
In Q
OUT[3]
timer3
IN[3]
PT[4]
TON
In Q
OUT[4]
timer4
IN[4]
PT ET
In Q
PT[i]
TON
OUT[i]
timer[i]
IN[i]
Here, array variables are
used to specify instances of
the function block definition
TON and all input parameters
and output parameters. All of
the element numbers are
incremented to execute five
instances in succession.
ENO