3 . I n s t r u c t i o n S e t
M N050 03003E F or mo re infor ma tio n vi sit:
w w w. e a t o n . c o m
3-97
API Mnemonic
Operands
Function
42
ENCO P
S, D, n
Encode
Bit Devices
Word devices
Program Steps
Type
OP
X Y M S K H KnX KnY KnM KnS T
C D E
F
S
*
*
*
*
*
*
*
*
*
D
*
*
*
*
*
n
*
*
DECO, DECOP: 7 steps
ELC ELCB
ELCM
PB PC/PA/PH
PV
PB PH/PA
32 16
P
32 16
P
32 16
P 32 16 P 32 16
P
Operands:
S
: Source to encode
D
: Destination for storing encoded data
n
: Number of bits to encode
Description:
1.
Encodes the lower “2
n
” bits of source
S
and stores the result in
D
.
2.
If the source device
S
has multiple bits set to a 1, processing is performed on the highest bit
position. The bit number set in S is encoded to the low bits of D.
3.
This instruction works best with the pulse instruction (ENCOP).
4. When
operand
S
is a bit device,
n
=1~8, when operand
S
is a word device,
n
=1~4
5.
ELC-PC/PA/PH, ELCM-PH/PA series: If no bits in
S
is active (1), M1067, M1068 = ON and
D1067 records the error code H0E1A.
Program Example 1:
1.
S
valid range: 0<
n
≦
8. If
n
=0 or
n
>8, an error will occur.
2. When
n
=8, the maximum decoded data is 2
8
= 256 points.
3.
When X0 goes from OFF
→
ON, the data in (M0 to M7) will be encoded and stored in the low
3 bits of D0 (b2 to b0). The unused bits in D0 (b15 to b3) will be all set to 0.
4.
After the execution is completed, X0 is changed to OFF and the data in
D
remain unchanged.
ENCOP
M0
K3
D0
X0
0
0
0
0
0
0 0
0
0
0
0
0
1
0
0
1
2
4
b15
b0
1
0
0
0
0
1
0
0
0
7
6
5
4
3
2
1
0
M07
M06
M05
M04
M03
M02
M01
M00
All be 0 (zero)
When 3 is specified as effective bits, 8 points are occupied.
Result after encoding
Which point, counting from M0, is ON and stored in BIN.
D0
Summary of Contents for ELC-PB
Page 1: ......
Page 5: ...For more information visit www eaton com MN05003003E iv...
Page 29: ...ELC Programming Manual For more information visit www eaton com MN05003003E 1 24 MEMO...
Page 502: ...3 Instruction Set MN05003003E For more information visit www eaton com 3 333...
Page 601: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 432...
Page 625: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 456...