Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
Is there some way to create a length-dynamic array in a FB?
I need to declare as in/out parameter of a s FB a not-fixed size array and specify its length as a parameter
ex:
The only way I found to set in stand of array[0..31] the expression array[0..Variable] is suing constant, like this
VAR CONSTANT
Lenght: INT;
END_VAR
VAR_OUTPUT
STEPS: ARRAY[0..Length] OF BOOL; ( Array of bit steps )
END_VAR
Lenght:= xx;
but when try to assign "Length" get always error.. (constant variable cannot be assigned..)
how to do it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there some way to create a length-dynamic array in a FB?
I need to declare as in/out parameter of a s FB a not-fixed size array and specify its length as a parameter
ex:
The only way I found to set in stand of array[0..31] the expression array[0..Variable] is suing constant, like this
VAR CONSTANT
Lenght: INT;
END_VAR
VAR_OUTPUT
STEPS: ARRAY[0..Length] OF BOOL; ( Array of bit steps )
END_VAR
Lenght:= xx;
but when try to assign "Length" get always error.. (constant variable cannot be assigned..)
how to do it?
no not possible the array can not be dynamic. in version 2