
7-205
LEN(P)
1
2
3
4
6
6
7
8
7.11 Character string processing instructions
7.11.8 Character string length detection (LEN(P))
Operation Error
(1) In the following case, an operation error occurs, the error flag (SM0) turns ON, and an error
code is stored into SD0.
• There is no "00 H" set within the relevant device range following the device number
designated by . (Error code: 4101)
Program Example
(1) The following program outputs the length of the character string from D0 to Y40 to Y4F as
BCD 4-digit values.
[Ladder Mode]
[List Mode]
[Operation]
S
Outputs the length of character
string to a display device.
Step Instruction Device
D1
D2
D3
4DH (M)49H (I)
54H (T)53 H (S)
b15 b8b7 b0
55H (U)42H (B)
D0
49H (I)53H (S)
10
BCD value
0010
D10 Y4F Y40
48H (H)49H (I)
00H
B1H (A)
B2H (B)B3H (C)
D4
D5
D6
"MITSUBISHI"
(Characters "ABC"
that follow 00H are ignored)
BCD
BCD conversion