Greetings!
What I'm trying to do is using INPUTS and OUTPUTS of the ANY format in FC's, or to be correct, I'm looking for a workaround with the same functionality since I want variable byte lengths on my inputs/outputs.
I know this:
ANY is only allowed in VAR or VAR_TEMP when it comes to FC's
If it had been an FB:
If anyone knows how to write this properly I'd be most grateful for "any" insights.
If I'm unlucky I have to use a Function Block instead
What I'm trying to do is using INPUTS and OUTPUTS of the ANY format in FC's, or to be correct, I'm looking for a workaround with the same functionality since I want variable byte lengths on my inputs/outputs.
I know this:
ANY is only allowed in VAR or VAR_TEMP when it comes to FC's
If it had been an FB:
Code:
TYPE AnyPointer
STRUCT //ANY structure
ANY_ID: BYTE;
DataType: BYTE;
Length: INT;
DBNO: WORD;
BytePointer: DWORD;
END_STRUCT;
END_TYPE;
FUNCTION_BLOCK FB607
VAR_INPUT
IA: AnyPointer;
SMAX: AnyPointer;
SMIN: AnyPointer;
RAW_VALUE AT IA: ANY;
SCALE_MAX AT SMAX: ANY;
SCALE_MIN AT SMIN: ANY;
END_VAR;
//This part is not legal even in FB's, but I want it! :)
VAR_OUTPUT
OA: AnyPointer;
OUTPUT_VALUE AT OA: ANY;
END_VAR;
// No code as of yet.
END_FUNCTION_BLOCK
If I'm unlucky I have to use a Function Block instead
Last edited: