Mitsubishi Electronics FX3G User Manual

Page of 964
637
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
26 Character String Control – FNC200 to FNC209
26.9 FNC208 – INSTR / Character string search
21
FNC160
-F
NC1
69
R
eal
 T
ime C
lock
 
C
ontrol
22
FNC17
0-F
NC
179
E
xternal D
evice
23
FNC
180
Alternate 
Instructions
24
FN
C181-
FNC18
9
O
thers
25
FNC190
-F
NC1
99
Bl
oc
k D
ata
 
Op
er
ation
26
FNC20
0-F
NC209
C
har
ac
te
r S
trin
Con
tro
l
27
FNC2
10-
FNC21
9
Dat
Operati
on 3
28
FNC220
-F
NC2
49
Da
ta 
C
omp
ari
son
29
FNC25
0-F
N
C
269
D
ata T
abl
Operation
30
FNC2
70-
FNC276
Ex
-Dev
ice
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 string
Character 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