AH500 Programming Manual 
6-264 
API 
Instruction code  Operand  Function 
1202    DECO  P 
S, D, n 
Decoder 
Device
X  Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#  “$”  DF 
16-bit instruction (7 steps) 
Symbol: 
S
:
Source device  Bit/Word 
D
:
Device in which the decoded values are 
stored 
Bit/Word 
n
:
Number of bits whose values are decoded  Word 
Explanation: 
1.  The values of the lower n bits in the source device specified by S are decoded as the values of 
the lower 2
n
 bits in D. 
2.  When D is a bit device, n is within the range between 1 and 8. When n is 8, the values of the 8 
bits is decoded as the values of the 256 bits. (Please note that the devices in which the 
decoded values are stored can not be used repeatedly.) 
3.  When D is a word device, n is within the range between 1 and 4. When n is 4, the values of the 
4 bits is decoded as the values of the 16 bits. 
4.  Generally, the pulse instruction DECOP is used. 
 
Example 1: 
1.  When Y0.0 is switched from OFF to ON, the instruction DECO decodes the values of the 3 bits 
in X0.0~X0.2 as the values of the 8 bits in M100~M107. 
2.  After the values of the 3 bits in X0.0~X0.2 are added up, the value 3 is gotten. The third bit in 
M10~M1007, that is, the bit in M103, is set to 1. 
3.  After the instruction DECO is executed and Y0.0 is switched OFF, the values of the 8 bits in 
M100~M107 are unchanged.
 
 
X0.2 X0.1
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 12
3