Publication 1766-RM001A-EN-P - October 2008
Conversion Instructions
245
ENC - Encode
1-of-16 to 4
Instruction Type: output
The ENC instruction searches the source from the lowest to the highest
bit, looking for the first bit set. The corresponding bit position is written to
the destination as an integer. The ENC instruction converts the values as
shown in the table below:
Updates to Math Status Bits
ENC
Encode 1 of 16 to 4
Source
N7:0
0000000000000000<
Dest
N7:1
0000h<
ENC
Execution Time for the ENC Instruction
Controller
When Rung Is:
True
False
MicroLogix 1400
5.7230 µs
0.3660 µs
Encode 1-of-16 to 4
Source Bits
Destination Bits
15
14
13
12
11
10
09
08
07
06
05
04
03
02
01
00
15 to 04
03
02
01
00
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
1
0
0
0
0
0
x
x
x
x
x
x
x
x
x
x
x
x
x
x
1
0
0
0
0
0
1
x
x
x
x
x
x
x
x
x
x
x
x
x
1
0
0
0
0
0
1
0
x
x
x
x
x
x
x
x
x
x
x
x
1
0
0
0
0
0
0
1
1
x
x
x
x
x
x
x
x
x
x
x
1
0
0
0
0
0
0
1
0
0
x
x
x
x
x
x
x
x
x
x
1
0
0
0
0
0
0
0
1
0
1
x
x
x
x
x
x
x
x
x
1
0
0
0
0
0
0
0
0
1
1
0
x
x
x
x
x
x
x
x
1
0
0
0
0
0
0
0
0
0
1
1
1
x
x
x
x
x
x
x
1
0
0
0
0
0
0
0
0
0
1
0
0
0
x
x
x
x
x
x
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
x
x
x
x
x
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
x
x
x
x
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
x
x
x
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
x
x
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
x
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
x = determines the state of the flag
TIP
If source is zero, the destination is zero and the math status is zero, the flag
is set to 1.
Math Status Bits
With this Bit:
The Controller:
S:0/0
Carry
always resets
S:0/1
Overflow
sets if more than one bit in the source is set; otherwise resets. The math
overflow bit (S:5/0) is not set.
S:0/2
Zero Bit
sets if result is zero, otherwise resets
efesotomasyon.com - Allen Bradley,Rockwell,plc,servo,drive