Skip to content

struct type in C++ does not show up correctly in PLCNext Engineer

I have followed the example provided by other discussion for creating struct type in C++, and the code compiles without issue. However, when i add the library in PLCNext, i do not see the struct. Not sure what i missed. please help

C++ code

PLCNext

I was expecting to see something like this in PLCNext once the library is imported per below discussion

Forum - PLCnext Community (plcnext-community.net)


I am using PLCNext Eng - 2022.3

AXC F 3152 -

PLCnCLI - 2021.6

Please let me know how I can fix it.

Comments

  • After sending the project to the PLC and going online, you should be able to add that port variable to the Watch window:


  • Martin,

    Apologies. I was hoping to see the individual struct variables in the Port list rather than the watch window.

    Is using structured text is the only way to assign the IEC variables to struct variables as it is not visible in the GDS port list?

    assign this to C++ variable HighLim to IEC variable _HighLim.

    Please clarify.

  • edited August 2022

    One solution would be to create an OUT port variable in the PLCnext Engineer project, using the STRUCT data type that was imported with the C++ library.

    Then, connect the new OUT port variable to the matching IN port variable on the C++ program instance.

    Then in any IEC language - not only Structured Text - you can assign values to individual elements of the OUT port variable.

    Will that be OK for your project?

  • Martin,

    I am now able to see the C++ struct variables, I am not sure if a restart of PLCNext was needed but this did not show up yesterday. I have IEC variables as external type, would that cause any issues?

    Thanks!

Sign In or Register to comment.