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