7-68
7.5 Data Processing Instructions
7.5.4 Encoding from 256 to 8 bits
ENCO
O
peration Error
In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and
the corresponding error code is stored to SD0.
• The value of n is outside the range of 0 to 8.
(Error code: 4100)
• The range of 2
n
bits from
exceeds the corresponding device.
(Error code: 4101)
• All data of 2
n
bits from
are 0.
(Error code: 4100)
Program Example
In the following program, the 3 bits from M10 are encoded when X20 turns ON, and the results
are stored to Var_D8.
[Structured ladder]
[ST]
ENCOP(X20,M10,3,Var_D8);
[Operation]
s
s
0
0
0
0
0
0
0
0
0
1
1
S
torage
d
ev
i
ce
Var
_
D
8
0
T
he
l
ocat
i
on
of
the
ON bi
t
,
counte
d
from
M10, i
s
store
d i
n
B
IN d
ata
.
E
nco
di
ng
resu
l
t
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
M10
M17
0
I
f
3 bi
ts
are
spec
i
f
i
e
d
as
s
i
gn
i
f
i
cant
bi
ts
, 8
po
i
nts
are
occup
i
e
d.
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......