6F3B0253
200 T1-16S User’s Manual
7. Instructions

FUN 120 ENC Encode

Expression
Input [ A ENC (n) B ] Output
Function
When the input is ON, this instruction finds the bit position of the most significant ON bit in the bit
table, size 2n bits starting with 0 bit (LSB) of A, and stores it in B.
Execution condition
Input Operation O utput ERF
OFF No execution OFF
ON Norm al execution ON
There is no ON bit (no execution) OFF Set
Operand
Name Device Register Constant Index
X Y R S T. C. XWYWRWSW T C D I J K
AStart of table √√√√√√√
nTable size 1 - 8
BEncode result √√√√√√√√√
Example
25 (=32) bits starting with 0 bit of RW05 (R050 to R06F) are defined as the bit table.
When R010 is ON, the most significant ON (1) bit position in the bit table is searched, and the
position is stored in D0010.
The following figure shows an operation example.
RW06 RW05
313029282726252423222120191817161514131211109 3210
00000100100110000111010 0010
D0010 26
Note
If there is no ON bit in the bit table, the instruction error flag (ERF = S051) is set to ON.