ValueSet (FB)ΒΆ
FUNCTION_BLOCK ABSTRACT ValueSet IMPLEMENTS IValueSet
Basic function block to implement a set of values.
A
ValueSet
contains an array of Value instances for reading or writing.Note
This kind of function block should be generated automatically by a configuration
Usage (Declaration):
{attribute 'no_assign'}
{attribute 'call_after_init'}
FUNCTION_BLOCK FINAL ValueSet EXTENDS UA.ValueSet
VAR
_aValues : ARRAY[0..1] OF UA.Value := [
(
eType := UA.IEC_UDINT,
pValue := ADR(udiValue),
psNodeId := ADR('ns=4;s=path.udiValue')
),
(
eType := UA.IEC_STRING,
pValue := ADR(sValue),
udiSize := SIZEOF(sValue),
psNodeId := ADR('ns=4;s=path.sValue')
)
];
END_VAR
Override the Init
method of UA.ValueSet
and set _pValues
and _udiItemCount
:
{attribute 'call_after_init'}
METHOD PROTECTED FINAL Init
_pValues := ADR(_aValues);
_udiItemCount := SIZEOF(_aValues) / SIZEOF(UA.Value);
SUPER^.Init();
Implement the method PrepareValues
of UA.ValueSet
:
METHOD PROTECTED FINAL PrepareValues : UA.ERROR
(* 0 *) _aValues[0].pValue := ADR(udiValue);
(* 1 *) _aValues[1].pValue := ADR(sValue);
Methods:
Structure: