Chapter 6 Applied Instructions Symbol: D : Device in which the encoded values S : Source device Bit/Word are stored Word n : Number of bits whose values are encoded Word Explanation: 1. The values of the lower 2 n bits in the source device specified by S are encoded as the values of the lower n bits in D . 2. If there are many bits whose values are 1 in the source device specified by S , the first bit with the value 1 from the left is processed. 3. When S is a bit device, n is within the range between 1 and 8. When n is 8, the values of the 256 bits is encoded as the values of the 8 bits. 4. When S is a word device, n is within the range between 1 and 4.
When n is 4, the values of the 16 bits is encoded as the values of the 4 bits. 5. Generally, the pulse instruction ENCOP is used. Example 1: 1. When X0.0 is switched from OFF to ON, the instruction ENCO encodes the values of the 8 bits in M0~M7 as the values of the lower 3 bits in D0, and the values of b15~b3 in D0 become 0. 2. After the instruction ENCO is executed and X0.0 is switched OFF, the data in D is unchanged. M7 M6 M5 M4 M3 M2 M1 M0 The values of b15~b3 in D0 become 0.
b0 6-267 API Instruction code Operand Function 1203 ENCO P S, D, n Encoder Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S D n Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 - 0 0 0 0 1 0 0 0 7 6 5 4 3 2 1 0 b15 D0 4 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0