Delta Electronics Programmable Logic Controller DVP-PLC User Manual
Page 271
![background image](/manuals/75807/271/background.png)
6 Application Instructions API 00-49
DVP-PLC Application Manual
6-59
API Mnemonic
Operands
Function
41
DECO P
Decode
Controllers
ES/EX/SS SA/SX/SC EH/SV
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
PULSE 16-bit 32-bit
ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV
Operands:
S
: Source device to be decoded D: Device for storing the decoded result n: Length of decoded bits
Explanations:
1. Range
of
n
when D is a bit device: 1 ~ 8
2. Range
of
n
when D is a word device: 1 ~ 4
3.
ES/EX/SS series MPU does not support E, F index register modification.
4.
See the specifications of each model for their range of use.
5.
The lower “n” bits of S are decoded and the results of “2
n
” bits are stored in D.
6.
This instruction adopts pulse execution instructions (DECOP)
Program Example 1:
1. When D is used as a bit device, n = 1 ~ 8. Errors will occur if n = 0 or n > 8.
2. When
n
= 8, the maximum points to decode is 2
8
= 256 points. (Please be aware of the storage range of the
devices after the decoding and do not use the devices repeatedly.)
3.
When X10 = Off→On, this instruction will decode the content in X0 ~ X2 to M100 ~ M107.
4.
When the source of data is 1 + 2 = 3, set M103, the 3
rd
bit starting from M100, as 1.
5.
After the execution of this instruction is completed and X10 turns to Off, the content that has been decoded and
output keeps acting.
X10
DECOP
D10
D20
K3
X2
X1
X0
M107 M106 M105 M104 M103 M102 M101 M100
0
1
1
1
0
0
0
0
0
0
0
3
7
6
5
4
2
1
0
4
1
2
3
Program Example 2:
1. When D is used as a word device, n = 1 ~ 4. Errors will occur if n = 0 or n > 4.
2. When
n
= 4, the maximum points to decode is 2
4
= 16 points.
3.
When X10 = Off→On, this instruction will decode b2 ~ b0 in D10 to b7 ~ b0 in D20. b15 ~ b8 that have not been
used in D20 will all become 0.