625
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
Programming Manual - Basic & Applied Instruction Edition
26 Character String Control – FNC200 to FNC209
26.4 FNC203 – LEN / Character String Length Detection
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-FNC276
Ex-Device
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 01
BCD value
Y057 to Y040
“ ABC.......”
b7----b0