464
LEN, LENP
F
unct
i
on
(1) Detects length of character string designated by and stores in the area starting from the device number designated by
.
Processes the data from the device number designated by to the device number storing "00
H
" as a character string.
For example, when the value "ABCDEFGHI" is stored in the area starting from , the value 9 is stored at .
Operat
i
on
E
rror
(1) In the following case, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into SD0.
Program
E
xamp
l
e
(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]
Error
code
Error details
Q00J/
Q00/
Q01
QnH
QnPH QnPRH
QnU
LCPU
4101
There is no "00
H
" set within the range of the corresponding device after
the device number specified in .
––
S
D
S
1st character
2nd character
3rd character
4th character
b15
b8b7
b0
5th character
6th character
nth character
00
H
Indicates the end of character string
b15
b0
Length of character string
S
D
S
S
S
S
D
+
1
4
1
H
(A)
4
2
H
(B)
4
3
H
(C)
44
H
(D)
b15
b8b7
b0
4
5
H
(
E
)
4
6
H
(
F
)
+
2
+
3
+4
4
7
H
(G)
4
8
H
(
H
)
4
9
H
(
I
)
00
H
"
ABCD
EF
G
HI"
b15
b0
9
S
D
S
S
S
S
S
Outputs the length of character
string to a display device.
Step
I
nstruct
i
on
De
vi
ce
D1
D2
D3
4
D
H
(M)
4
9
H
(
I
)
5
4
H
(
T
)
53
H
(S)
b15
b8b7
b0
55
H
(
U
)
4
2
H
(B)
D0
4
9
H
(
I
)
53
H
(S)
10
BCD
v
a
l
ue
0 0 1 0
D10
Y4F
Y4
0
4
8
H
(
H
)
4
9
H
(
I
)
00
H
4
1
H
(A)
4
3
H
(B)
4
2
H
(C)
D
4
D5
D6
"
M
IT
S
U
B
I
S
HI"
(Characters
"
ABC
"
that
fo
ll
o
w
00
H
are
i
gnored)
BCD
BCD
con
v
ers
i
on