Chapter 7 Second Development PlatformVP3000
327
API Instruction code Operand Function
41 DECO P S, D, n
Decode
Type
Operand
Bit devices Word devices
16-bit instruction (7 steps)
DECO
Continuous
execution
type
DECOP
Pulse
execution
type
32-bit instruction
- - - -
Associated flag: none
X Y M K H KnX KnY KnM T C D
S
D
n
Caution for using operand
When operand D is bit device, n = 1–8, and when operand D is word
device, n = 1–4.
Description
S: source device to be decoded
D: device for storing the decoded result
n: length of decoded bits
The instruction decodes the lower “n” bits of S and stores the result of “2
n
” bits in D.
Example
Example 1
1. When D is used as a bit device, the valid range is 0 < n 8. Error occurs when n = 0 or n >
8.
2. When n = 8, the maximum points to decode is 2
8
= 256 points.
3. When M200 = OFFON, this instruction decodes the content in X0–X2 to M100–M107
4. If S = 3, M103 (third bit from M100) = ON.
5. After the execution is completed, M200 becomes OFF. The decoded results have been
output retain their operation.
X2 X1 X0
M107 M106 M10 5 M104 M103 M102 M101 M100
011
1
0000 000
3
76 54 210
4 12
3
Example 2
1. When D is used as a word device, the valid range is 0 < n 4. Error occurs when n = 0 or
n > 4.
2. When n = 4, the maximum points to decode is 2
4
= 16 points.
3. When M200 = OFFON, this instruction decodes the content in D10 (b2–b0) to D20 (b7–
b0). The unused bits in D20 (b15–b8) become 0.
4. The lower 3 bits of D10 are decoded and stored in the lower 8 bits of D20. The higher 8
bits of D20 are all 0.
5. After the execution is completed, M200 becomes OFF. The decoded results have been
output retain their operation.
DECOP X0 K3M100
00