Chapter 16 PLC Function ApplicationsC2000-HS
16-74
API
ENCO
S D
n
Encoder
42
D P
Bit device Word device
16-bit command (7 STEP)
ENCO Continuous
execution type
ENCOP Pulse
execution type
32-bit command (13 STEP)
DENCO Continuous
execution type
DENCOP Pulse
execution type
Flag signal: none
X Y M K H KnX KnY KnM T C D
S * * * * * *
D * * * * *
n * *
Notes on operand usage: none
S
: Encoding source device.
D
: Device that saves the encoding result.
n
: Length of encoding bit.
Encodes the data of lower “2
n
” bit length from encoding source device S, and
saves the encoding result in D.
If multiple digits of encoding source device are 1, the command will process the
first digit starting from high digit.
This command usually uses pulse execution type command (ENCOP).
When S is the bit device, n = 1–8, when S is the word device, n = 1–4.
When S is the bit device, the valid range of n is 0< n ≦8. If n = 0 or n > 8, a fault
will occur.
When n = 8, the maximum decoding will be 2
8
= 256 points.
When X0 switches from Off to On, the content of 2
3
digit (M0–M7) is encoded and
saved in the lower 3 digits (b2–b0). The unused digits (b15–b3) in D0 become 0.
When the command is executed, X0 turns to Off. The data in D is unchanged.
ENCOP M0 K3D0
X0
When S is word device, the valid range of n is 0< n ≦4. If n = 0 or n > 4, the fault
occurs.
When n = 4, the maximum decoding will be 2
4
= 16 points.
When X0 switches from Off to On, 2
3
digit data of D10 (b0–b7) is encoded and
saved in the lower 3 digits (b2–b0) of D20. The unused digits (b15–b3) of D20
become 0. (b8–b15 in D10 are invalid data)
When the command is executed, X0 turns to Off. The data in D is unchanged.
DECOP D10 K3D20
M200