636
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
Programming Manual - Basic & Applied Instruction Edition
26 Character String Control – FNC200 to FNC209
26.9 FNC208 – INSTR / Character string search
26.9 FNC208 – INSTR / Character string search
Outline
This instruction searches a specified character string within another character string.
1. Instruction format
2. Set data
3. Applicable devices
Explanation of function and operation
1. 16-bit operation (INSTR and INSTRP)
1) The character string stored in and higher is searched for within the character string and higher. The
search begins at the "n"th character from the left end (head character) of and the search result is stored in
. The search result provides the first matching character (located from the left end (head character)) in
.
2) When the searched character string is not detected, "0" is stored in .
3) When the search start position "n" is a negative number or "0", search processing is not executed.
Operand Type Description Data Type
Head device number storing a character string Character string
Head device number storing a character string to be searched Character string
Head device number storing search result 16-bit binary
n Search start position 16-bit binary
Oper-
and
Type
Bit Devices Word Devices Others
System User Digit Specification System User
Special
Unit
Index
Con-
stant
Real
Number
Charac-
ter String
Pointer
XYMTCSD
.b KnX KnY KnM KnS T C D R
U\G
V Z Modify K H E "
"P
n
P
FNC 208
INSTR
Mnemonic Operation Condition
16-bit Instruction
9 steps
INSTR
INSTRP
Mnemonic Operation Condition
Continuous
Operation
Pulse (Single)
Operation
32-bit Instruction
⎯
⎯
S
1
S
2
D
S
1
S
2
D
S
1
S
2
S
2
D
S
2
Command
input
FNC208
INSTR
S
2
S
1
D
n
+0
b15
+2
+3
+4
b8 b7 b0
"ABCDEFGHIJK"
S
2
+1
+5
Search is started from
the 3rd character (n = 3).
Fifth character from
the head character
46H(F)
48H(H)
45H(E)
47H(G)
42H(B)
44H(D)
41H(A)
43H(C)
4AH(J) 49H(I)
00H 4BH(K)
+0
b15 b8 b7 b0
"EFGH"
S
1
+1
+2
5
The position where the
first detected character
is located from the
head character in the
character string data
stored in .
46H(F)
48H(H)
45H(E)
47H(G)
00H
Character stringCharacter string to be searched
D
S
2
S
1
S
2
D