Mitsubishi Electric MELSEC FX3U Programming Manual page 658

Melsec fx series programmable logic controllers
Table of Contents

Advertisement

FX
/FX
/FX
Series Programmable Controllers
3G
3U
3UC
Programming Manual - Basic & Applied Instruction Edition
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
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.
X000
b15---b8
49H(I) 4DH(M)
D0
D1
53H(S) 54H(T)
D2
42H(B) 55H(U)
D3
53H(S)
D4
49H(I) 48H(H)
41H(A)
D5
D6
43H(C)
656
FNC203
LEN
FNC 18
BCD
b7----b0
49H(I)
"MITSUBISHI"
(Characters
" ABC......."
after "00H" are
00H
ignored.)
42H(B)
26 Character String Control – FNC200 to FNC209
26.4 FNC203 – LEN / Character String Length Detection
D0
D10
The length of the character
string is output to the display
D10
K4Y40
unit.
END
Conversion
D10
into BCD
10
BCD
(error code:
S
Y057 to Y040
0 0
1
0
BCD value

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec fx3ucMelsec fx3g

Table of Contents