Chapter 4. Ladder Diagram (LD) ProgrammingGFK-2950C February 2018 694.2.2 Bit PositionThe Bit Position function locates a bit set to 1 in a bit string.Each scan that power is received, the function scans the bit string starting at IN. When the functionstops scanning, either a bit equal to 1 has been found or the entire length of the string has beenscanned.POS is set to the position within the bit string of the first non-zero bit; POS is set to zero if no non-zero bit is found.A string length of 1 to 256 WORDs or DWORDs can be selected. The function passes power flow tothe right whenever it receives power.Operands of Bit PositionParameter Description Allowed Operands OptionalLength(displayed as ??)The number of WORDs or DWORDs in the bitstring. 1 Length 256.Constants NoIN The data to operate on All. Constants may only beused when Length is 1.NoQ Energized if a bit set to 1 is found Flow YesPOS An unsigned integer giving the position of the firstnonzero bit found, or zero if no non-zero bit isfoundAll except constants andvariables located in %S - %SCNoExamplesWhen V_I00001 is set, the bit string starting at V_M00001 is searched until a bit equal to 1 is found,or 6 words have been searched. Coil V_Q00001 is turned on. If a bit equal to 1 is found, its locationwithin the bit string is written to V_AQ0001 and V_Q00002 is turned on. For example, if V_00001 isset, bit V_M00001 is 0, and bit V_M0002 is 1, the value written to V_AQ0001 is 2.