464
LEN, LENP
Function
(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 .
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.
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]
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 character2nd character
3rd character4th character
b15 b8b7
b0
5th character6th 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
41
H
(A)42
H
(B)
43
H
(C)44
H
(D)
b15 b8b7 b0
45
H
(E)46
H
(F)
+2
+3
+4
47
H
(G)48
H
(H)
49
H
(I)00
H
"ABCDEFGHI"
b15 b0
9
S
D
S
S
S
S
S
Outputs the length of character
string to a display device.
Step Instruction Device
D1
D2
D3
4D
H
(M)49
H
(I)
54
H
(T)53
H
(S)
b15 b8
b7
b0
55
H
(U)42
H
(B)
D0
49
H
(I)53
H
(S)
10
BCD value
0 010
D10
Y4F Y40
48
H
(H)49
H
(I)
00
H
41
H
(A)
43
H
(B)42
H
(C)
D4
D5
D6
"MITSUBISHI"
(Characters "ABC"
that follow 00
H
are ignored)
BCD
BCD conversion