Publication 1763-RM001C-EN-P - October 2009
Programming Instructions Overview
85
Indirect Addressing of a File
•
Address: N[N50:100]:10
•
Description: In this example, the source of the COP instruction is
indirected by N50:100. The data in N50:100 defines the data file
number to be used in the instruction. In this example, the copy
instruction source A is defined by N[N50:100]:10. When the
instruction is scanned, the data in N50:100 is used to define the data
file to be used for the COP instruction. If the value of location
N50:100 = 27, this instruction copies 15 elements of data from
N27:10 (N27:10 to N27:24) to N7:0 (N7:0 to N7:14)
TIP
If a number larger than 255 is placed in N50:100 in
this example, a controller fault occurs. This is
because the controller has a maximum of 255 data
files. In addition, the file defined by the indirection
should match the file type defined by the instruction,
in this example an integer file.
TIP
This example also illustrates how to perform a limit
check on the indirect address. The limit instruction at
the beginning of the rung is monitoring the indirect
element. If the data at N50:100 is less than 10 or
greater than 25, the copy instruction is not
processed. This procedure can be used to make sure
an indirect address does not access data an
unintended location.
0001
LIM
Limit Test
Low Lim
10
10<
Test
N50:100
10<
High Lim
25
25<
LIM
B3:0
0
COP
Copy File
Source #N[N50:100]:10
Dest
#N7:0
Length
15
COP
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive