I’m trying to read out the Resistor Measurement Settings from a EL3356 over Can over Ethernet (CoE). I’m using the FB_EcCoeSdoReadEx
function block for this.
Then I want to use the bCompleteAccess
to read out the whole Resistor Measurement Settings at once instead of going through all the individual parameters. For this I defined the following struct
<code>TYPE RMB_Config : STRUCT
MaxSubIndex : USINT; (* Max. subindex, RO, default: 50dec *)
Mode0EnableFilter : BIT; (* 0: No filters active, 1: Filters active, RW, default: TRUE *)
Mode1EnableFilter : BIT; (* Applies only to EL3356-0010, EL3356-0090, RW, default: TRUE *)
Mode0EnableAverager : BIT; (* Activate hardware mean value filter, RW, default: TRUE *)
Mode1EnableAverager : BIT; (* Applies only to EL3356-0010, EL3356-0090, RW, default: TRUE *)
SymmetricReference : BIT; (* Activate symmetric measurement, RW, default: TRUE *)
Mode0FilterSettings : UINT; (* Filter settings for mode 0, RW, default: 0 *)
Mode1FilterSettings : UINT; (* Filter settings for mode 1, applies only to EL3356-0010, EL3356-0090, RW, default: 0 *)
DynamicFilterChangeTime :
UINT; (* Sampling rate for dynamic filter switching, RW, default: 10dec *)
DynamicFilterDelta : REAL; (* Limit value for dynamic filter switching, RW, default: 20.0 *)
Gain : REAL; (* Scale factor, RW, default: 1.0 *)
Tare : REAL; (* Process data value offset, RW, default: 0.0 *)
REAL; (* Nominal characteristic value of the sensor element in mV/V, RW, default: 2.0 *)
NominalLoad : REAL; (* Nominal load of the transducer, RW, default: 5.0 *)
ZeroBalance : REAL; (* Zero point offset in mV/V, RW, default: 0.0 *)
GravityOfEarth : REAL; (* Current acceleration of gravity, RW, default: 9.806650 *)
ScaleFactor : REAL; (* Factor for re-scaling the process data, RW, default: 1000.0 *)
ReferenceLoad : REAL; (* Reference weight for manual calibration, RW, default: 5.0 *)
SteadyStateWindow : UINT; (* Time constant for "steady state" bit, RW, default: 1000dec *)
SteadyStateTolerance : UDINT; (* Tolerance window for "steady state" bit, RW, default: 5dec *)
UINT; (* Calibration interval for automatic calibration, RW, default: 1800dec *)
TestInterval : UINT; (* Test interval for the cyclic self-test, RW, default: 10dec *)
<code>TYPE RMB_Config : STRUCT
MaxSubIndex : USINT; (* Max. subindex, RO, default: 50dec *)
Mode0EnableFilter : BIT; (* 0: No filters active, 1: Filters active, RW, default: TRUE *)
Mode1EnableFilter : BIT; (* Applies only to EL3356-0010, EL3356-0090, RW, default: TRUE *)
Mode0EnableAverager : BIT; (* Activate hardware mean value filter, RW, default: TRUE *)
Mode1EnableAverager : BIT; (* Applies only to EL3356-0010, EL3356-0090, RW, default: TRUE *)
SymmetricReference : BIT; (* Activate symmetric measurement, RW, default: TRUE *)
Mode0FilterSettings : UINT; (* Filter settings for mode 0, RW, default: 0 *)
Mode1FilterSettings : UINT; (* Filter settings for mode 1, applies only to EL3356-0010, EL3356-0090, RW, default: 0 *)
DynamicFilterChangeTime :
UINT; (* Sampling rate for dynamic filter switching, RW, default: 10dec *)
DynamicFilterDelta : REAL; (* Limit value for dynamic filter switching, RW, default: 20.0 *)
Gain : REAL; (* Scale factor, RW, default: 1.0 *)
Tare : REAL; (* Process data value offset, RW, default: 0.0 *)
RatedOutput :
REAL; (* Nominal characteristic value of the sensor element in mV/V, RW, default: 2.0 *)
NominalLoad : REAL; (* Nominal load of the transducer, RW, default: 5.0 *)
ZeroBalance : REAL; (* Zero point offset in mV/V, RW, default: 0.0 *)
GravityOfEarth : REAL; (* Current acceleration of gravity, RW, default: 9.806650 *)
ScaleFactor : REAL; (* Factor for re-scaling the process data, RW, default: 1000.0 *)
ReferenceLoad : REAL; (* Reference weight for manual calibration, RW, default: 5.0 *)
SteadyStateWindow : UINT; (* Time constant for "steady state" bit, RW, default: 1000dec *)
SteadyStateTolerance : UDINT; (* Tolerance window for "steady state" bit, RW, default: 5dec *)
CalibrationInterval :
UINT; (* Calibration interval for automatic calibration, RW, default: 1800dec *)
TestInterval : UINT; (* Test interval for the cyclic self-test, RW, default: 10dec *)
END_STRUCT
END_TYPE
</code>
TYPE RMB_Config : STRUCT
MaxSubIndex : USINT; (* Max. subindex, RO, default: 50dec *)
Mode0EnableFilter : BIT; (* 0: No filters active, 1: Filters active, RW, default: TRUE *)
Mode1EnableFilter : BIT; (* Applies only to EL3356-0010, EL3356-0090, RW, default: TRUE *)
Mode0EnableAverager : BIT; (* Activate hardware mean value filter, RW, default: TRUE *)
Mode1EnableAverager : BIT; (* Applies only to EL3356-0010, EL3356-0090, RW, default: TRUE *)
SymmetricReference : BIT; (* Activate symmetric measurement, RW, default: TRUE *)
Mode0FilterSettings : UINT; (* Filter settings for mode 0, RW, default: 0 *)
Mode1FilterSettings : UINT; (* Filter settings for mode 1, applies only to EL3356-0010, EL3356-0090, RW, default: 0 *)
DynamicFilterChangeTime :
UINT; (* Sampling rate for dynamic filter switching, RW, default: 10dec *)
DynamicFilterDelta : REAL; (* Limit value for dynamic filter switching, RW, default: 20.0 *)
Gain : REAL; (* Scale factor, RW, default: 1.0 *)
Tare : REAL; (* Process data value offset, RW, default: 0.0 *)
RatedOutput :
REAL; (* Nominal characteristic value of the sensor element in mV/V, RW, default: 2.0 *)
NominalLoad : REAL; (* Nominal load of the transducer, RW, default: 5.0 *)
ZeroBalance : REAL; (* Zero point offset in mV/V, RW, default: 0.0 *)
GravityOfEarth : REAL; (* Current acceleration of gravity, RW, default: 9.806650 *)
ScaleFactor : REAL; (* Factor for re-scaling the process data, RW, default: 1000.0 *)
ReferenceLoad : REAL; (* Reference weight for manual calibration, RW, default: 5.0 *)
SteadyStateWindow : UINT; (* Time constant for "steady state" bit, RW, default: 1000dec *)
SteadyStateTolerance : UDINT; (* Tolerance window for "steady state" bit, RW, default: 5dec *)
CalibrationInterval :
UINT; (* Calibration interval for automatic calibration, RW, default: 1800dec *)
TestInterval : UINT; (* Test interval for the cyclic self-test, RW, default: 10dec *)
END_STRUCT
END_TYPE
Then I try to read it using this code
<code>PROGRAM CoEReaderTest
coeReader : FB_EcCoeSdoReadEx;
rmbSettings : RMB_Config;
starting_index : BYTE := 16#0;
nSubIndex:=starting_index,
pDstBuf:=ADR(rmbSettings),
cbBufLen:=SIZEOF(rmbSettings),
<code>PROGRAM CoEReaderTest
VAR
coeReader : FB_EcCoeSdoReadEx;
rmbSettings : RMB_Config;
starting_index : BYTE := 16#0;
execute : BOOL;
END_VAR
coeReader(
sNetId:=Config.netId,
nSlaveAddr:=1009,
nIndex:=16#8000,
nSubIndex:=starting_index,
pDstBuf:=ADR(rmbSettings),
cbBufLen:=SIZEOF(rmbSettings),
bExecute:=execute,
bCompleteAccess:=TRUE
);
</code>
PROGRAM CoEReaderTest
VAR
coeReader : FB_EcCoeSdoReadEx;
rmbSettings : RMB_Config;
starting_index : BYTE := 16#0;
execute : BOOL;
END_VAR
coeReader(
sNetId:=Config.netId,
nSlaveAddr:=1009,
nIndex:=16#8000,
nSubIndex:=starting_index,
pDstBuf:=ADR(rmbSettings),
cbBufLen:=SIZEOF(rmbSettings),
bExecute:=execute,
bCompleteAccess:=TRUE
);
The MaxSubIndex
is read out correctly, but starting from the next parameter the bits do not seem to line up anymore. All other numbers are then not correct.
What I’ve tried to do is to us {attribute 'pack_mode':= '0'}
with all different pack modes: 0, 1, 2, 4, 8, but none of them seem to align the struct correctly. Also, I replaced the BIT
‘s with BOOL
‘s, but that didn’t solve it either.
Any ideas on how to solve this? I couldn’t find examples where bCompleteAccess
is used.