Topic: DMD0161 SR - Shift Register |
|
The Shift Register (SR) instruction shifts BITs through a predefined number of BIT locations. These BIT locations can be a range of BITs, a single Word or DWord, or a range of Words or DWords.
The Shift Register can only shift Bits through the specified range, it cannot be used to shift Byte, Word or DWord values. Refer to the FIFO example in the Move Range (MOVER) instruction on how to shift non-Bit values.
|
|
Input Legs:The Shift Register (SR) instruction has the following three ladder logic input legs:
The first ladder logic input leg (DAT) is the Data signal. This determines the value (one or zero) that will enter the shift register.
If the input logic is ON a value of 1 will
be placed in the starting location of the shift register with the next
transition of the Clock signal.
The second ladder logic input leg is the Clock signal. The gray triangle at the right end of an input leg indicates the input is edge triggered Each time the input logic transitions from OFF to ON this instruction will execute. With each execution, this instruction will run to completion even if the input logic transitions to OFF before the instruction completes. meaning that each OFF-to-ON transition of the Clock signal will shift all of the bits in the shift register one position and move the Data leg's value into the first shift register bit location.
The third ladder logic input (RST) is the Reset signal. When ON, the Reset signal resets all bit positions in the shift register locations to zero.
|
|
Parameters:Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.
Range Type - specifies the
memory locations that will be used by the Shift Register instruction.
Select one of the following three options for the Range Type:
Start - if Range of Bits or Range of Words / DWords is selected this entry specifies the first memory location to use. If Single Word / DWord is selected, this is the single memory location to use. This can be any writable Bit or Word / DWord location.
End - if Range of Bits or Range of Words / DWords is selected this entry specifies the last memory location to use. This can be any writable Bit or Word / DWord location.
|
|
Status Display:The status display of the Shift Register will display as many of the registers being used as possible. If the full range of the registers cannot be displayed in the instruction, only the first and last registers will be displayed.
This configuration uses bits C0 to C15, status for all 16 bits can be displayed in the instruction.
This configuration uses bits C0 to C63, status for all 64 bits cannot be displayed, only the first 16 bits and the final 16 bits are displayed.
This configuration uses a single DWord D0, status for all 32 bits can be displayed in the instruction.
This configuration uses Words V0 and V1, status for all 32 bits can be displayed in the instruction.
This configuration uses DWords D0 to D9, status for all 320 bits cannot all be displayed, only the first 16 bits of D0 and the final 16 bits of D9 are displayed in the instruction.
|
|
See Also:
SR - Shift Register
|
|
Example:
|
|