The Function represents a shift register for any kind of Datatype (using variant
).
It is possible to shift the elements in the array at bufferRegister
to the left (index array[n]:=array[n+1]
) or right (index array[n]:=array[n-1]
).
It could be used for material tracking trough a machine or a process, e.g. for a rotary indexing table.
bufferRegister
.LGF_ShiftRegister (FB) | ||||||||
---|---|---|---|---|---|---|---|---|
Bool | shiftLeft | error | Bool | |||||
Bool | shiftRight | status | Word | |||||
UInt | shiftRange | subFunctionStatus | Word | |||||
Bool | clear | |||||||
Bool | fill | |||||||
Variant | initialItem | |||||||
Variant | bufferRegister | Variant | ||||||
Identifier | Data type | Default value | Description |
---|---|---|---|
shiftLeft | Bool | FALSE | Rising edge: Elements in the array `bufferRegister` shifted left. Elements moved from index `N` to `N - 1`. The element at index `N = 0`is overwritten |
shiftRight | Bool | FALSE | Rising edge: Elements in the array `bufferRegister` shifted right. Elements moved from index `N` to `N + 1`. The element at index `N = lastIndex` is overwritten |
shiftRange | UInt | 1 | Number of places to be shifted in the `bufferRegister` input array |
clear | Bool | FALSE | Clear buffer elements in `bufferRegister` with `initalItem` |
fill | Bool | FALSE | Overwrite buffer elements after shift operation. * `shiftLeft` - the most right element/s * `shiftRight` - the most left element/s overwritten by `initalItem`. |
initialItem | Variant | --- | Value with which the array at input `bufferRegister` is initialized (usually the default value) |
Identifier | Data type | Description |
---|---|---|
error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB |
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table) |
subFunctionStatus | Word | Status or return value of called FB's, FC's and system blocks |
Identifier | Data type | Description |
---|---|---|
bufferRegister | Variant | Buffer / Register memory as ARRAY, which keeps the data. The data in the register is shifted left or right depending on the command. |
Code / Value | Identifier / Description |
---|---|
16#0000 | STATUS_NO_ERROR Status: Execution finished without errors |
16#7000 | STATUS_NO_CURRENT_JOBS Status: No current jobs, initial state |
16#8200 | ERR_NO_ARRAY Error: No array is present at the input `bufferRegister` |
16#8201 | ERR_CLEARING_WITHOUT_INITIAL_ITEM Error: Claering `bufferRegister` without an `initialItem` is not possible. |
16#8202 | ERR_FILL_WITHOUT_INITIAL_ITEM Error: Option `fill` the buffer after shift operation without an `initialItem` is not possible. |
16#8203 | ERR_WRONG_TYPE_INITIAL_ITEM Error: The data type of the input `initialItem` does not correspond to the data type of the array at the InOut parameter `bufferRegister`. |
16#8401 | ERR_MORE_THAN_ONE_COMMAND Error: More than one command present at the same time. Only one of the inputs `shiftLeft`, `shiftRight` or `clear` is allowed. |
16#8402 | ERR_IN_SHIFT_RANGE Error: The value at `shiftRange` must not exceed the maximum size of the Array at `bufferRegister`. |
16#8610 | ERR_CLEAR_BUFFER Error: While clearing buffer in block `MOVE_BLK_VARIANT``. Check `subFunctionStatus` code. |
16#8611 | ERR_SHIFT_BUFFER_LEFT Error: While shift buffer left in block `MOVE_BLK_VARIANT` - check `subFunctionStatus` code |
16#8612 | ERR_SHIFT_BUFFER_LEFT_FILL Error: While fill buffer after shift left in block `MOVE_BLK_VARIANT` - check `subFunctionStatus` code |
16#8622 | ERR_SHIFT_BUFFER_RIGHT Error: While shift buffer right in block `MOVE_BLK_VARIANT` - check `subFunctionStatus` code |
16#8622 | ERR_SHIFT_BUFFER_RIGHT_FILL Error: While fill buffer after shift right in block `MOVE_BLK_VARIANT` - check `subFunctionStatus` code |
Version & Date | Change description | |
---|---|---|
01.00.00 | Siemens Industry Online Support | |
03.07.2018 | First released version | |
03.00.00 | Simatic Systems Support | |
09.04.2021 | Refactoring and alignment to Datatype Variant Insert documentation |