F_BA_GetUsedEntryCount

The function F_BA_GetUsedEntryCount of return type DINT searches the memory area of an ARRAY for the first entry marked as "unused" with xUnusedVal.
The memory area of the array is examined step by step starting from the address pArray: the step size is given by the size of xUnusedVal, the number of comparison steps by the difference of nLowerBound and nUpperBound. It is assumed that the entries nLowerBound and nUpperBound are correct.
The return value of the function shows how many elements do not match the value xUnusedVal until it is found. If the value is found, the search is aborted.
In case of an incorrect input, i.e. pArray = 0 or if the size of xUnusedVal = 0, the function is aborted immediately and takes "0" as return value.
Syntax
FUNCTION F_BA_GetUsedEntryCount : DINT
VAR_INPUT
pArray : PVOID;
nLowerBound : DINT;
nUpperBound : DINT;
xUnusedVal : ANY;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
pArray | PVOID | Pointer to the beginning of the memory area where the array to be examined is located. |
nLowerBound | DINT | Lower range limit of the array. |
nUpperBound | DINT | Upper range limit of the array. |
xUnusedVal | ANY | If an element of the array has the value specified here, it is considered "unused". |
Requirements
Development environment | Required PLC library |
---|---|
TwinCAT 3.1 4024.35 | Tc3_BA2_Common from V2.1.20.0 |