Mitsubishi MELSEC-Q/L Programming Manual page 466

Table of Contents

Advertisement

LEN, LENP
Function
(1) Detects length of character string designated by
.
D
Processes the data from the device number designated by
b15
b8b7
S
2nd character
S
4th character
S
6th character
00
S
H
Indicates the end of character string
For example, when the value "ABCDEFGHI" is stored in the area starting from
b15
b8b7
S
42
(B)
H
S
+1
44
(D)
H
S
+2
46
(F)
H
S
+3
48
(H)
H
S
+4
00
H
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.
Error
code
There is no "00
" set within the range of the corresponding device after
H
4101
the device number specified in
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]
Step
Instruction
[Operation]
b15
b8b7
D0
49
(I)
H
D1
53
(S)
H
D2
42
(B)
H
D3
53
(S)
H
D4
49
(I)
H
D5
41
(A)
H
D6
42
(C)
H
464
and stores in the area starting from the device number designated by
S
b0
1st character
3rd character
5th character
nth character
b0
41
(A)
H
43
(C)
H
"ABCDEFGHI"
45
(E)
H
47
(G)
H
49
(I)
H
Error details
.
S
Outputs the length of character
string to a display device.
Device
b0
4D
(M)
H
54
(T)
H
55
(U)
H
"MITSUBISHI"
49
(I)
H
(Characters "ABC"
48
(H)
H
that follow 00
are ignored)
H
00
H
43
(B)
H
to the device number storing "00
S
b15
b0
Length of character string
D
, the value 9 is stored at
S
b15
b0
D
9
Q00J/
Q00/
QnH
Q01
––
D10
Y4F
BCD conversion
10
BCD
BCD value
" as a character string.
H
.
D
QnPH QnPRH
QnU
LCPU
Y40
0 0 1 0

Advertisement

Table of Contents
loading

Table of Contents