03.01.2013 Views

Toshiba PROSEC T1-16S PLC User's Manual - CTi Automation

Toshiba PROSEC T1-16S PLC User's Manual - CTi Automation

Toshiba PROSEC T1-16S PLC User's Manual - CTi Automation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7. Instructions<br />

FUN 120 ENC Encode<br />

Expression<br />

Input −[ A ENC (n) B ]− Output<br />

200 <strong>T1</strong>-<strong>16S</strong> User’s <strong>Manual</strong><br />

6F3B0253<br />

Function<br />

When the input is ON, this instruction finds the bit position of the most significant ON bit in the bit<br />

table, size 2 n bits starting with 0 bit (LSB) of A, and stores it in B.<br />

Execution condition<br />

Input Operation Output ERF<br />

OFF No execution OFF −<br />

ON Normal execution ON −<br />

There is no ON bit (no execution) OFF Set<br />

Operand<br />

Name Device Register Constant Index<br />

X Y R S T. C. XWYWRWSW T C D I J K<br />

A Start of table √ √ √ √ √ √ √<br />

n Table size 1 - 8<br />

B Encode result √ √ √ √ √ √ √ √ √<br />

Example<br />

2 5 (=32) bits starting with 0 bit of RW05 (R050 to R06F) are defined as the bit table.<br />

When R010 is ON, the most significant ON (1) bit position in the bit table is searched, and the<br />

position is stored in D0010.<br />

The following figure shows an operation example.<br />

RW06 RW05<br />

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<br />

0 0 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 0 1 0 0 0 1 0<br />

D0010 26<br />

Note<br />

• If there is no ON bit in the bit table, the instruction error flag (ERF = S051) is set to ON.<br />

<strong>CTi</strong> <strong>Automation</strong> - Phone: 800.894.0412 - Fax: 208.368.0415 - Web: www.ctiautomation.net - Email: info@ctiautomation.net

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!