How to read out a whole struct over CoE with TwinCAT?

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<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>
<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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<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>
<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.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật