FIFO (First-In First-Out / Queue / ring buffer memory)
This function stores incoming data and outputs the oldest unprocessed data.
LGF_FIFO (FB) | ||||||||
---|---|---|---|---|---|---|---|---|
Bool | enqueue | error | Bool | |||||
Bool | dequeue | status | Word | |||||
Bool | reset | subFunctionStatus | Word | |||||
Bool | clear | elementCount | DInt | |||||
Variant | initialItem | isEmpty | Bool | |||||
Variant | item | Variant | ||||||
Variant | buffer | Variant | ||||||
Identifier | Data type | Default value | Description |
---|---|---|---|
enqueue | Bool | false | Enqueue item to the buffer |
dequeue | Bool | false | Dequeue item from the buffer and return it on `item` |
reset | Bool | FALSE | Initializing the buffer (reset the index and the counter) |
clear | Bool | FALSE | Clearing the buffer and initialize with the initial value `initialItem` (Reset index and counter). |
initialItem | Variant | --- | Value with which the ARRAY of the buffer is initialized (usually: `0` / 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 |
elementCount | DInt | Number of elements in the buffer |
isEmpty | Bool | TRUE: Buffer is empty |
Identifier | Data type | Description |
---|---|---|
item | Variant | The entry that is either returned from the ring buffer or written into the buffer |
buffer | Variant | The ARRAY that is used as the ring buffer. (Array of…) |
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#8001 | ERR_BUFFER_EMPTY Error: The buffer is empty |
16#8002 | ERR_BUFFER_FULL Error: The buffer is full |
16#8200 | ERR_NO_ARRAY Error: No array is present at the input `buffer` |
16#8201 | ERR_WRONG_TYPE_ITEM Error: The data type of the InOut parameter `item` does not correspond to the data type of the array elements of the input `buffer` |
16#8202 | ERR_WRONG_TYPE_INITIAL_ITEM Error: The data type of the input `initialValue` does not correspond to the data type of the InOut parameter `item` |
16#8601 | ERR_INDEX_IN_ARRAY_LIMITS_1 Error: The tag `statNextEmptyItemIndex` is not within the array limits |
16#8602 | ERR_INDEX_IN_ARRAY_LIMITS_2 Error: The tag `statFirstItemIndex` is not within the array limits |
16#8610 | ERR_CLEAR_BUFFER Error: While clearing buffer in block `MOVE_BLK_VARIANT` - check `subFunctionStatus` code |
16#8611 | ERR_RETURN_FIRST_ENTRY Error: While return first entry of buffer in block `MOVE_BLK_VARIANT` - check `subFunctionStatus` code |
16#8612 | ERR_REPLACE_ITEM_BY_INIT_VALUE Error: While replace item by initial value in block `MOVE_BLK_VARIANT` - check `subFunctionStatus` code |
16#8613 | ERR_WRITE_ENTRY Error: While write entry to buffer in block `MOVE_BLK_VARIANT` - check `subFunctionStatus` code |
subFunctionStatus
. In this case, the output value in status
indicates which command caused the error. In this case, refer to the TIA Portal Online Help section for information on the respective commands.With the enqueue
input, a new item is stored from the InOut parameter item
in the next free position in the buffer. The output elementCount
is incremented by one.
With the dequeue
input, the next element to be processed is output to the InOut parameter item
, and this field in the buffer is replaced by the value in the parameter initialItem
. The output elementCount
decremented by one.
With the reset
input, the buffer is initialized and the index and counter are reset. The elementCount
output is set to zero and the isEmpty
output is set to TRUE.
With the clear
input, the buffer is emptied and initialized with the initial value initialItem
. Index and counter are reset. The elementCount
output is set to zero and the isEmpty
output is set to TRUE.
Version & Date | Change description | |
---|---|---|
01.00.00 | Siemens Industry Online Support | |
19.08.2015 | First released version | |
01.00.01 | Siemens Industry Online Support | |
16.11.2015 | Bug fix resetBuffer | |
01.00.02 | Siemens Industry Online Support | |
02.01.2017 | Upgrade: TIA Portal V14 Update 1 | |
01.00.03 | Siemens Industry Online Support | |
17.08.2018 | Upgrade: TIA V15 Update 2 | |
01.00.04 | Siemens Industry Online Support | |
23.11.2018 | Upgrade: TIA V15.1 | |
02.00.00 | Siemens Industry Online Support | |
29.01.2019 | Output "done" removed (not necessary, because block works synchronous) | |
03.00.00 | Simatic Systems Support | |
22.10.2019 | Code refactoring, comments added Interface change (enqueue, dequeue etc.) Set version to V3.0.0, harmonize the version of the whole library | |
03.00.01 | Simatic Systems Support | |
15.02.2021 | Insert documentation |