3. Instructions
578
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Function
DIM(631) registers the words from TB to TB+LR×NR-1 as table number N. Table number N has NR
records and each record is LR words long. The data within this region cannot be changed once the
region has been declared as records.
Records in a registered table are identified by their record numbers, which range from 0 to NR-1.
Hint
• Use DIM(631) in combination with SETR(635) (SET RECORD NUMBER) or GETR(636) (GET
RECORD NUMBER) to simplify the calculation of addresses in data tables. Use DIM(631) to divide
data into records and then use SETR(635) to store the first address of the desired record in an Index
Register. The Index Register can then be used as a pointer in other instructions, such as read, write,
search, or compare instructions.
• As an example, if temperatures, pressures, or other set values are stored as records and the records
for various models are combined into a table, it is easy to read the set values for each models for any
particular conditions.
Related instructions
• SETR(635) sets the leading PLC memory address of the specified record number in the specified
Index Register.
• GETR(636) outputs the record number of the record that includes the specified Index Register value
(PLC memory address).
Example Programming
When CIO 0.00 is ON in the following example, DIM(631) defines record table number 2 with three 10-
word records. The table begins at D300.
Number of records
Table number (N)
Record 0
Record 1
Record NR–1
LR
× NR words
LR: D100
NR: D200
N
LR
NR
TB
D300
D301
D309
D310
D319
D320
D329
Record 0
Record 1
Record 2
Record length: 10 words
Number of records: 3
10 words
10 words
10 words
Table number 2
0.00
D100
D200
D300