4:29 AM
0
Overview of Shift Instructions


You can use the Shift instructions to move the contents of input IN bit by bit to the left or the right (see also CPU Registers). Shifting n bits to the left multiplies the contents of input IN by 2 to the power n (2 n); shifting n bits to the right divides the contents of input IN by 2 to the power n (2 n). For example, if you shift the binary equivalent of the decimal value 3 to the left by 3 bits, you obtain the binary equivalent of the decimal value 24. If you shift the binary equivalent of the decimal value 16 to the right by 2 bits, you obtain the binary equivalent of the decimal

value 4.



The number that you supply for input parameter N indicates the number of bits by which the value is shifted. The bit places that are vacated by the Shift instruction are either padded with zeros or with the signal state of the sign bit (0 stands for positive and 1 stands for negative). The signal state of the bit that is shifted last is loaded into the CC 1 bit of the status word, see also CPU Registers. The CC 0 and OV bits of the status word are reset to 0. You can use jump instructions to evaluate the CC 1 bit.



The following Shift instructions are available:



·       SHR_I :       Shift Right Integer



·       SHR_DI :    Shift Right Double Integer



·       SHL_W :     Shift Left Word



·       SHR_W :    Shift Right Word



·       SHL_DW :  Shift Left Double Word



·       SHR_DW : Shift Right Double Word

0 comments:

Post a Comment

Labels

Actuator Sensor-interface Address Negative Edge Detection Address Positive Edge Detection ADDRESSING ANALOG INPUTS ANALOG OUTPUTS AND Logic Operation AS-i AS-i configuration Assign Authorizations Automation License Manager BASICS Bit Bit Configuration Bit Logic Instructions Block By-passing CiR CiR Modules CiR Objects communication COMPARISON Components Configuration Configuring Connections Conversion Converting Counter CP 343-2 P CP 443-5 Ext CPU CPU 412-1 CPU 412-2 DP CPU 412-2 PCI CPU 414-2 DP CPU 414-3 DP CPU 414-4 H CPU 416-2 DP CPU 416-2 PCI CPU 416-3 DP CPU 416F-2 CPU 417-4 CPU 417-4 H Data Block DI/DO MODULES Diagnosing Diagnosis DIGITAL INPUTS DIGITAL OUTPUTS Downloading DP master English Mnemonics ET 200M Exclusive OR Logic Operation Extended pulse timer fail-safe modules fault FBD Floating- Point Floating-Point Math FUNCTION MODULES German Mnemonics Hardware hmi Input Insert Binary Input install Instructions Integer Math INTERFACE MODULES Jump License License Keys Load Memory Master Control Relay Memory Areas Memory Reset Midline Output Modifying MODULES monitoring variables Move NEG Negate Binary Input Negative RLO Edge Detection Networks Off-delay timer On-delay timer Operating systems OR Logic Operation Output PID Control PLC POS position decoder Positive RLO Edge Detection PROFIBUS Program Control programm Programming Pulse timer RELAY OUTPUTS Remote Reset Output Reset_Set Flip Flop Retentive on-delay timer Rotate RS S5 File S7 Communications S7-300 S7-400 SAVE Save RLO to BR Memory SCADA Set Output Set_Reset Flip Flop Shift siemens SIMATIC SIMATIC Manager Slaves Software SR STATEMENT Status Bit STEP 7 stop mode Time Base Time Value Timer Timer Cell TRAINING MODULE Units Upgrading UPLOADING WinLC RTX Word Logic Work Memory XOR