Chapter 4. Ladder Diagram (LD) ProgrammingGFK-2950C February 2018 674.2 Bit Operation FunctionsThe Bit Operation functions perform comparison, logical, and move operations on bit strings.Function Mnemonics DescriptionBit Position BIT_POS_DWORDBIT_POS_WORDBit Position. Locates a bit set to 1 in a bit string.Bit Sequencer BIT_SEQ Bit Sequencer. Sequences a string of bit values, starting at ST.Performs a bit sequence shift through an array of bits. The maximumlength allowed is 256 words.Bit Set, Clear BIT_SET_DWORDBIT_SET_WORDBit Set. Sets a bit in a bit string to 1.BIT_CLR_DWORDBIT_CLR_WORDBit Clear. Clear a bit within a string by setting that bit to 0.Bit Test BIT_TEST_DWORDBIT_TEST_WORDBit Test. Tests a bit within a bit string to determine whether that bit iscurrently 1 or 0.Logical AND AND_DWORDAND_WORDCompares the bit strings IN1 and IN2 bit by bit. When a pair ofcorresponding bits are both 1, places a 1 in the correspondinglocation in output string Q; otherwise, places a 0 in the correspondinglocation in Q.Logical NOT NOT_DWORDNOT_WORDLogical invert. Sets the state of each bit in output bit string Q to theopposite state of the corresponding bit in bit string IN1.Logical OR OR_DWORDOR_WORDCompares the bit strings IN1 and IN2 bit by bit. When a pair ofcorresponding bits are both 0, places a 0 in the correspondinglocation in output string Q; otherwise, places a 1 in the correspondinglocation in Q.Logical XOR XOR_DWORDXOR_WORDCompares the bit strings IN1 and IN2 bit by bit. When a pair ofcorresponding bits are different, places a 1 in the correspondinglocation in the output bit string Q; when a pair of corresponding bitsare the same, places a 0 in Q.MaskedCompareMASK_COMP_DWORDMASK_COMP_WORDMasked Compare. Compares the contents of two separate bit stringswith the ability to mask selected bits.Rotate Bits ROL_DWORDROL_WORDRotate Left. Rotates all the bits in a string a specified number ofplaces to the left.ROR_DWORDROR_WORDRotate Right. Rotates all the bits in a string a specified number ofplaces to the right.Shift Bits SHIFTL_DWORDSHIFTL_WORDShift Left. Shifts all the bits in a word or string of words to the left by aspecified number of places.SHIFTR_DWORDSHIFTR_WORDShift Right. Shifts all the bits in a word or string of words to the rightby a specified number of places.