Chapter 5 Applied Instructions S : Source device; D : Device in which a decoding result is stored; n : Number of bits which are decoded The low n bits in S are decoded as the low 2 n bits in D . Generally, the pulse instruction DECOP is used. D is in the range of 1 to 8. Explanation When D is a bit device, n is in the range of 1 to 8. If n is 0, or greater than 8, an error will occur. If n is 8, the maximum number of bits which can be decoded is 2 8 =256. When X2.0 is turned from OFF to ON, the instruction DECOP decodes X0.0~X0.2 as M100~M107. If the value in S is 3, M103 will be ON.
After the instruciton is executed, X2.0 will be OFF, and the states of M100~M107 will remain unchanged. Example 1 DECOP K3 X2.0 X0.2 X0.1 X0.0 4 1 2 3 0 3 7 6 5 4 2 1 0 When D is a word device, n is in the range of 1 to 8. If n is 0, or greater than 8, an error will occur. If n is 8, the maximum number of bits which can be decoded is 2 8 =256. When X2.0 is turned from OFF to ON, the instruction DECOP decodes b2~b0 in D10 as b7~b0 in D20, and b15~b8 in D20 become 0. The low 3 bits in D10 are decoded as the low 8 bits in D20. The high 8 bits in D20 are 0. After the instruciton is executed, X2.0 will be OFF, and the value in D20 will remain unchanged.
M107 M106 M105 M104 M103 M102 M101 M100 Example 2 X2.0 b15 b0 D10 b15 b0 D20 5-61 API Instruction code Operand Function 41 DECO P S, D, n Decoder Device Xn.n Yn.n M S K 16# F KnM KnS D W T C V Z S D n Pulse instruction 16-bit instruction (7 steps) 32-bit instruction – X0.0 M100 0 1 1 0 0 0 0 1 0 0 DECOP D10 D20 K3 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 4 2 1 Bit 15~bit 8 in D10 become 0. 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0