637
FX3G/FX3U/FX3UC Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
26 Character String Control – FNC200 to FNC209
26.9 FNC208 – INSTR / Character string search
21
FNC160-FNC169
Real Time Clock
Control
22
FNC170-FNC179
External Device
23
FNC180
Alternate
Instructions
24
FNC181-FNC189
Others
25
FNC190-FNC199
Block Data
Operation
26
FNC200-FNC209
Character String
Control
27
FNC210-FNC219
Data
Operation 3
28
FNC220-FNC249
Data
Comparison
29
FNC250-FNC269
Data Table
Operation
30
FNC270-FNC274
Ex-Device
Inverter Comms
4) A character string can be directly specified in the character string .
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is stored in
D8067.
• When the search start position "n" exceeds the number of characters stored in (error code: K6706)
• When "00H (NULL)" is not located within the corresponding device range starting from (error code: K6706)
• When "00H (NULL)" is not located within the corresponding device range starting from (error code: K6706)
Program example
1) In the program example below, the character string "CI23" (D0 and later) is searched from the 5th character from
the left end (head character) of the character string "CI2312CIM" (R0 and later) when X000 is set to ON. The
search result is stored in D100
S
1
42H(B)
41H(A)
+0
b15
+2
+3
+4
b8 b7 b0
"1234AB56AB"
S
2
+1
+5
32H(2)
34H(4)
36H(6)
31H(1)
33H(3)
35H(5)
42H(B) 41H(A)
"AB"
5
D100
Search is started from
the 3rd character (n = 3).
Fifth character from
the head character
Character stringCharacter string to be searched
S
1
S
2
00H
S
2
S
1
S
2
X000
FNC208
INSTR
D0 R0 D100 K5
R0
b15
R2
R3
R4
b8 b7 b0
"CI2312CIM"
R1
These characters are not
searched because the
search start position is "5".
The search source
character string is searched
from the 5th character.
32H(2)
49H(I)
31H(1)
43H(C)
49H(I)
33H(3)
43H(C)
32H(2)
00H 4DH(M)
D0
b15 b8 b7 b0
"CI23"
D1
D2
0
Because the searched
character string is not
detected, "0" is stored.
49H(I)
33H(3)
43H(C)
32H(2)
00H
D100
END
Character string to be searched R0 Character string D0