359
ENCO, ENCOP
1
2
3
4
4
6
7
8
7.5
D
ata pr
ocessin
g instru
ctions
7.5.4
E
NCO, ENCOP
Program Example
(1) The following program decodes the 3 bits from X0 and stores the results at M10 when X20 is ON.
[Ladder Mode]
[List Mode]
[Operation]
: Head number of the device where the data to be encoded is stored (Device name)
: Number of the device where the encoding result will be stored (BIN 16 bits)
n
: Valid bit length (1 to 8), 0: No processing (BIN 16 bits)
Function
(1) Stores the binary value corresponding to the bits which are "1" included in the 2
n
-bit data of to .
(2) The value of n can be designated at between 1 and 8.
(3) If n 0, there will be no operation, and the contents of will not change.
(4) Bit devices are treated as 1 bit, and word devices as 16 bits.
(5) If more than 1 bit is at 1, processing will be conducted at the upper bit location.
ENCO, ENCOP
Encoding from 256 to 8 bits
7.5.4
ENCO, ENCOP
Setting
Data
Internal Devices
R, ZR
J \
U \G
Zn
Constants
K, H
Other
Bit
Word
Bit
Word
––
––
––
––
––
n
––
Step
Instruction
Device
0
0
0
0
0
1
0
0
0
0
0
M10
M17
0
I
f
3
b
i
ts
are
des
i
gnated
as
s
i
gn
i
f
i
cant
b
i
ts
,
8
po
i
nts
are
occup
i
ed
.
Decod
i
ng
resu
l
t
0
0
1
1
0
X0
X1
X2
W
hen
6
i
s
des
i
gnated
at
X0
to
X2
Basic
Process
High
performance
Redundant Universal
LCPU
n
n
ENCO
ENCOP
D
D
Command
Command
ENCOP
ENCO
S
S
S
D
S
D
S
D
7
0
8
6
(
Binar
y
value = 6
)
5 4 3 2 1 0
0
1 0 0 0 0 0 0
1 1 0
S
D
D