Skip to content

c++ pass the output to PLCnext

I need to pass an array of string types to the PLC. The SDK port mode doesn't seem to work.

Comments

  • Hello lixin,

    please send me the definition of Array of String types, I'll verify this issue.

    Thanks!

    Best Regards,

    Eduard 

       

     

  • I'm using the tinyxml library, and I'm reading out the data in the XML file, and the GetText () output is (const char* type).

    The information in the red box in the XML file has been taken out by GetText. I want to package the data in the red box into an array and send it to the PLC.Please see the attachment for the picture

     

    const char* node1Name = xmlNode1_Name->GetText();

    cout << node1Name << endl;</p>

    TiXmlElement* brother = xmlNode1_Name->NextSiblingElement();

    TiXmlElement* brother = xmlNode1_Name->NextSiblingElement();

    while (brother)while (brother)

    { cout << brother->GetText() << endl;</p>

    brother = brother->NextSiblingElement();

    }

     

     

  • This works for me in 2020.0:

    This C++ program port ...

    //#port
    //#attributes(Output)
    StaticString myStringArray[10];

    ... can successfully be matched with a PLCnext Engineer IN port of this type:

    TYPE
       MyStringArrayType : ARRAY[0..9] OF STRING;
    END_TYPE

     ~ Martin.

  • 谢谢你的帮助

    今天,我将软件更新为2020.0,但是我定义了StaticString错误报告。请参阅错误报告图表的附件。

  • Hello,

    is this googletranslate correct?

    thank you for your help

    Today, I updated the software to 2020.0, but I defined a StaticString error report. See the attachment to the error report chart.


    Are you building successfully?
    Maybe it is only a issue of the eclipse Indexer?
    The type StaticString should be available through the Arp Namespace i think

    kind regards,
    Oliver

  • Can you give me a complete example to refer to? What kind of Arp Namespace do you build

  • Hello,

    Unfortunately I have just noticed that there is a typo in my earier code snippet, because this forum does not display angled brackets correctly (or at all). The port definition should look like this:

    13 12 2019 20 53 05

    Here is a short video showing a complete example using Eclipse with the add-in from PlcnCLI version 2020.0 and the AXC F 2152 SDK version 2020.0.

    This example:

    • Creates a new C++ project using the Eclipse wizard.
    • Adds a single Program port, which is an array with 10 elements of type StaticString.
    • Successfully builds the project to create a library for PLCnext Engineer.
    • Opens the header file that declares the StaticString<> type. This header file is already included in the default Eclipse project.



    Hope this helps.

    ~ Martin.

     

  • I wrote it your way and compiled it correctly, but I had no interface output on the PLCnext side

  • The PLCnext interface has no exclipe string output

  • Hello Lixin,

    was the library in the engineer sucessfully replaced after rebuilding it?
    Does rebuilding the Project help?
    It should look like this.

    You can Notice at the Type if you are using a old "plcncli" tool or eclipse plugin.

    WRONG:

    staticString

    Correct:

    staticString correct

     

     

    you can also Disable the Filters in the ProjectExplorer in eclipse and have a look at the intermeddiat/config/PROJECT.typemeta or  intermeddiat/config/COMPONENT/PROGRAM/PROGRAM.progmeta

    Make sure you have the 2020.0 PLCnCLI installed.
    After changing versions restart eclipse.

Sign In or Register to comment.