13: SHIFT / ROTATE INSTRUCTIONS13-4 « FC4A MICRO SMART USER ’S MANUAL »BCDLS (BCD Left Shift)Applicable CPU ModulesValid OperandsFor the valid operand number range, see pages 6-1 and 6-2.When T (timer) or C (counter) is used as S2, the timer/counter current value is read out.The quantity of digits to shift designated as S2 can be 1 through 7.Make sure that the source data determined by S1 and S1+1 is between 0 and 9999 for each data register. If either sourcedata is over 9999, a user program execution error will result, turning on special internal relay M8004 and the ERR LED onthe CPU module. When S2 is over 7, a user program execution error will also result.Example: BCDLSFC4A-C10R2/C FC4A-C16R2/C FC4A-C24R2/C FC4A-D20K3/S3 FC4A-D20RK1/RS1 & FC4A-D40K3/S3— — — — XOperand Function I Q M R T C D Constant RepeatS1 (Source 1) Data for BCD shift — — — — — — X — —S2 (Source 2) Quantity of digits to shift X X X X X X X 1-7 —When input is on, the 32-bit binary data designated by S1 is converted into 8BCD digits, shifted to the left by the quantity of digits designated by S2, and con-verted back to 32-bit binary data.Valid values for each of S1 and S1+1 are 0 through 9999.The quantity of digits to shift can be 1 through 7.Zeros are set to the lowest digits as many as the digits shifted.BCDLS S1*****Before shift:After shift:0 2 31MSDS1 S1+1Shift to the leftLSDS2*4 6 75 01 3 42 5 7 060When S2 = 1 (digits to shift)0M8120 is the initialize pulse special internal relay.When the CPU starts operation, the MOV (move) instructions set 123 and4567 to data registers D10 and D11, respectively.Each time input I0 is turned on, the 32-bit binary data of data registersD10 and D11 designated by S1 is converted into 8 BCD digits, shifted tothe left by 1 digit as designated by operand S2, and converted back to 32-bit binary data.Zeros are set to the lowest digits as many as the digits shifted.Before shift:After first shift:0 2 31D10 D11Shift to the left4 6 75 01 3 42 5 7 060REPSOTUI0S1 –4567 D1 –D11S1D10 S21BCDLSMOV(W)M8120REPS1 –123 D1 –D10MOV(W)After second shift:MSD LSD2 4 53 6 0 0710When S2 = 1 (digits to shift)