Mitsubishi Electronics FX3G User Manual

Page of 964
625
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.4 FNC203 – LEN / Character String Length Detection
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
Caution
• This instruction can handle character codes other than ASCII codes, but the character string length is handled in 
byte units (8 bits). Accordingly, in the case of character codes in which 2 bytes express 1 character such as shift 
JIS codes, the length of 1 character is detected as “2”.
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 “00H” is not set within the corresponding device range after a device specified by 
 (error code: K6706)
•  When the detected number of characters is “32768” or more (error code: K6706)
Program example
In the program example shown below, the length of a character string stored in D0 and later is output in 4-digit BCD to
Y040 to Y057 when X000 turns ON.
   
S
X000
D10
FNC203
LEN
D0
END
K4Y40
FNC 18
BCD
D10
The length of the character
string is output to the display
unit.
b15---b8
D0
D1
49H(I) 4DH(M)
53H(S) 54H(T)
53H(S)
D10
10
D3
42H(B) 55H(U)
49H(I)
“MITSUBISHI” 
(Characters
after “00H” are
ignored.)
49H(I) 48H(H)
D2
D4
D6
D5
43H(C)
41H(A)
00H
42H(B)
Conversion
into BCD
BCD
0 0
0
1
BCD value
Y057 to Y040
“ ABC.......”
b7----b0