132
SMARTAXIS LADDER PROGRAMMING MANUAL FT9Y-B1382
23-5
23: FILE DATA PROCESSING INSTRUCTIONS
NDSRC (N Data Search)
Applicable SmartAXIS
Valid Devices
For valid device address ranges, see "Device Addresses" on page 3-1.
Source S1 data specifies the value to be sought and the valid range depends on the data type.
The search range cannot straddle data registers and non-retentive data registers. Make sure that the sum of data register numbers designated by
S1 and S2 does not result in a different data register range.
For source S3 and destination D1, 1 word is always used without regard to the data type.
Destination D1 occupies two consecutive data registers starting with the device designated by D1. Data registers D0-D998 and D1000-D1998 can be
designated as destination D1.
When F (float) data is selected and S1 does not comply with the normal floating-point format, a user program execution error will result, turning on
special internal relay M8004 and ERR LED on the SmartAXIS. When a user program execution error occurs, the execution of the instruction is
canceled and the next instruction is executed.
When data in S2 to S2+(S3) does not comply with floating-point format, the data is skipped to continue the search and the results are stored in D1
and D1+1.
The NDSRC instruction cannot be used in an interrupt program.
If used, a user program execution error will result, turning on special internal relay M8004 and the ERR LED on the SmartAXIS.
When S3 is zero or the sum of S2 and S3 is not within the valid data register range, a user program execution error will result, turning on special
internal relay M8004 and ERR LED on the SmartAXIS. When a user program execution error occurs, the execution of the instruction is canceled and
the next instruction is executed.
For details about the user program execution errors, see "User Program Execution Errors" on page 4-13.
Since the NDSRC instruction is executed in each scan while input is on, a pulse input from a SOTU or SOTD instruction should be used.
Valid Data Types
Quantity of Source and Destination Devices
Depending on the data type, source devices S1 and S2 use a different quantity of devices. Source device S3 and destination device
D1 always use 1 word without regards to the data type.
When input is on, a value specified by device S1 is searched for. Data
registers are searched, starting with the data register assigned by device S2.
Device S3 specifies the quantity of 1-word or 2-word blocks of data registers
to search, depending on the data type.
The offset of the data register where a match first occurred is stored in data
register assigned by device D1. The number of matches is stored in the next
data register. When the search results in no match, 65535 is stored in device D1
and 0 is stored in device D+1.
NDSRC(*)
S1
*****
S2
*****
S3
*****
D1
*****
FT1A-12
FT1A-24
FT1A-40
FT1A-48
FT1A-Touch
X
X
X
X
X
Device
Function
I
Q
M
R
T
C
D
Constant
Repeat
S1 (Source 1)
Value to be sought
—
—
—
—
—
—
X
X
—
S2 (Source 2)
First data register number to search
—
—
—
—
—
—
X
—
—
S3 (Source 3)
Quantity of blocks to search
—
—
—
—
—
—
X
X
—
D1 (Destination 1)
Search result
—
—
—
—
—
—
X
—
—
W (word)
X
When a word device such as D (data register) is assigned as the source, 1 point (word or integer data) or 2
points (double-word, long, or float data) are used.
I (integer)
X
D (double word)
X
L (long)
X
F (float)
X
Device
W (word), I (integer)
D (double word), L (long), F (float)
S1, S2
1 word device
2 word devices
S3, D1
1 word device
1 word device