Download - Service, Support

Transcript
Programming and operating the FM 352-5
6.10 Operations in the FM 352-5 Library
6.10.18
Encode binary position (ENCODE)
Description
The ENCODE function converts the contents of IN to a binary number corresponding to the
bit position of the leftmost set bit in IN, and returns the result as the function's value. If IN is
either DW#16#00000001 or DW#16#00000000, a value of 0 is returned. If there is logic for
EN, the output is latched. The output changes only when EN is active. With logic for EN, the
ENCODE value is retentive, requiring storage and a phase clock.
31
IN
0
24 23
0 1
1 0 1
1 1
0
19
16 15
0 0 0 1
0 0 0 1
1 1
1 0 1
8
7
3
1 1
0
0 0 0 1
0 0
OUT = 29
Figure 6-46
Example of ENCODE
Most significant bit set is in bit position 29
LAD representation
ENCODE
EN
ENO
IN
OUT
Parameter
Data type
Addresses
Description
EN
BOOL
Input, constant
Signal state 1 at the enable input
activates the box.
IN
DWORD
Input, constant
Variable to be encoded.
ENO
BOOL
Output
Enable output follows the signal
state of EN.
OUT
INT
Output
Value output.
Error Information
This function does not detect any error states.
DIn[0]
DW#16#12345678
OUT
Figure 6-47
DOut[0]
ENCODE
EN
ENO
IN
OUT
NOT
Conn.arrICon[0]
28
Example of the Encode Binary Position Function
If the signal state of input DIn[0] is 1 (activated), the ENCODE function is executed.
DOut[0] is "1" if the operation is executed.
FM 352-5 high-speed Boolean processor
Operating Manual, 05/2011, A5E00131318-04
153