Chapter 4. Ladder Diagram (LD) Programming82 PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual GFK-2950C4.2.10 Shift BitsMnemonics:SHIFTL_DWORDSHIFTL_WORDSHIFTR_DWORDSHIFTR_WORDShift LeftWhen the Shift Left (SHIFTL_WORD) function receives power flow, it shifts all the bits in a word orgroup of words to the left by a specified number of places, N. When the shift occurs, the specifiednumber of bits is shifted out of the output string to the left. As bits are shifted out of the high end ofthe string (Most Significant Bit (MSB)), the same number of bits is shifted in at the low end (LeastSignificant Bit (LSB)). The SHIFTL_DWORD function operates in a similar manner on DWORDs insteadof WORDs.Shift RightWhen the Shift Right (SHIFTR_WORD) function receives power flow, it shifts all the bits in a word orgroup of words a specified number of places to the right (N). When the shift occurs, the specifiednumber of bits is shifted out of the output string to the right. As bits are shifted out of the low end ofthe string (LSB), the same number of bits is shifted in at the high end (MSB).Shift Left and Shift RightA string length (Length) of 1 to 256 words can be specified.The bits being shifted into the beginning of the string are specified via input parameter B1. If thevalue of N is greater than 1, each bit is filled with the same value (0 or 1). This can be:■ The Boolean output of another program function.■ All 1s. To do this, use the #AWL_ON (always on) system bit (in memory location %S7), as apermissive to input B1.■ All 0s. To do this, use the #ALW_OFF (always off) system bit (in memory location %S8), as apermissive to input B1.The Shift Bits function passes power flow to the right, unless the number of bits specified to shift iszero or is greater than the array size.Output Q is the shifted copy of the input string. If you want the input string to be shifted, the outputparameter Q must use the same memory location as the input parameter IN. The entire shiftedstring is written on each scan that power is received. Output B2 is the last bit shifted out. Forexample, if four bits were shifted, B2 would be the fourth bit shifted out.