6F3B0250
218
T1/T1S 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 2
n
bits starting with 0 bit (LSB) of
A
, and stores it in
B
.
Execution condition
Input Operation Output ERF
OFF No execution OFF
-
ON Normal execution ON
-
There is no ON bit (no execution) OFF Set
Operand
Name Device Re
g
ister Constant Index
X Y R S T. C. XW YW RW SW T C D I J K
A
Start of table
ÖÖÖÖÖÖÖ
n
Table size 1 - 8
B
Encode result
ÖÖÖÖÖÖÖÖÖ
Example
2
5
(=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
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 3 2 1 0
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.
CTi Automation - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: info@ctiautomation.net