Configure data for FP-FNS blocks
The FNS_InitConfigNameTable function creates a ConfigNameTable from the variable ProcessDataTable, which can be a single-element data type or a multi-element data type.
Input
Input and output of process data variables
Output
Configuration data for FP-FNS blocks. The array-size of the variable ConfigNameTable has to correspond to the number of elements of the ProcessDataTable variable.
Make sure that the size of the variable ConfigNameTable corresponds to the structure of the ProcessDataTable, e.g. if the ProcessDataTable consists of three entries, then the ConfigNameTable variable should be an "Array[0..2] of WORD", whose size matches the number of entries. If the ProcessDataTable variable has only one entry (e.g. WORD), then the ConfigNameTable variable should be an "Array[0..0] of WORD" (with size 1).
Allowed input data types are all 16-bit (INT, WORD), 32-bit (DINT, DWORD, TIME (32 bits), REAL) and 64-bit variables or arrays of them. 64-bit variables are defined as 2-dimensional arrays, e.g. "Array[0..0,0..3] of INT" is a 64-bit variable, while "Array[0..3] of INT" represents an array with four elements of 16-bit variables.
The data types BOOL, STRING and arrays of these types are NOT allowed at the input of the function FNS_InitConfigDataTable.
The output ConfigNameTable of the function must be an array of WORD.
The following syntax table shows how to declare 16-bit, 32-bit and 64-bit variables and arrays thereof when using them as ProcessDataTable input.
Input Data type |
Size of Input |
Comment |
---|---|---|
INT, WORD |
16-bit |
|
DINT, WORD, REAL, TIME |
32-bit |
|
Array[0..0,0..3] of INT Array[0..0,0..3] of WORD |
64-bit |
2-dimensional array; size of second dimension = 4 |
Array[a ..b] of INT/Array[a ..b] of WORD |
Array of 16-bit Size = b-a+1 |
1-dimensional array |
Array[a ..b] of DINT/Array[a ..b] of DWORD/ Array[a ..b] of REAL/Array[a ..b] of TIME |
Array of 32-bit Size = b-a+1 |
1-dimensional array |
Array[0..x,0..3] of INT Array[0..x,0..3] of WORD |
Array of 64-bit Size = x+1 |
2-dimensional array; size of second dimension = 4 |
VAR
adiDInt1: ARRAY[2..3] OF DINT:=[2(0)];
arReal1: ARRAY[0..1, 1..9] OF REAL:=[18(0.0)];
aui1: ARRAY[1..15] OF UINT:=[15(0)];
dwWord1: DWORD:=0;
iInt1: INT:=0;
udiUDInt1: UDINT:=0;
END_VAR
The size of the variable configNames1 has to correspond to the number of entries of the input variable myDUT60.
As the DUT has three entries, the output variable configNames1 has to be an array of WORD with a size of three (e.g.: Array [0..2] of WORD).
When sys_bIsFirstScan is TRUE, i.e. in the first cycle, the function is executed. The value of the variable configNames1 corresponds to the structure of the input variable myDUT60, its number and type of elements.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_VARIN,,myDUT60,11,2,13,4,);
B(B_VAROUT,,configNames1,29,2,31,4,);
B(B_F,E_FNS_InitConfigNameTable!,Instance,13,0,29,4,,?DEN?dProcessNameTable?AENO?cConfigNameTable);
B(B_VARIN,,sys_bIsFirstScan,11,1,13,3,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
If sys_bIsFirstScan then
configNames1:=FNS_InitConfigNameTable(myDUT60);
end_if;