C++ programs in PLCnext Technology 

With PLCnext Technology, you can use programs created with C++ in the real-time context of a PLC along with conventional IEC 61131‑3 programs. To use programs and pro­gram parts created in C++ within the scope of PLCnext Technology, Phoenix Contact provides tools and add-ins that help to integrate your C++ program in your real-time application in an easy way. 

Tools

  • Software Development Kits (SDKs) with important toolchains and libraries for both Windows® and Linux® are available for all PLCnext Control devices.
  • The PLCnext Technology Toolchain provides the following:
    • Administration of the SDKs
    • Build environment
    • Automatic generation of required metadata and configurations
    • Automatic creation of complete libraries
    • PLCnext CLI (PLCnext Command Line Interface), based on the .NET Core Framework and can be used on Windows® and Linux® operating systems.
  • You can use the freely available Eclipse® software with the Phoenix Contact Add-in as your C++ development environment for PLCnext Control devices. That add-in allows for easy connection to the PLCnext Technology platform and provides the PLCnext CLI functions out of your Eclipse® workbench.
  • If you prefer working with Microsoft® Visual Studio® there is a PLCnext Technology extension available, too.

How to

These are the steps to go for programming something in C++ to run on your PLCnext Control. All tools and ressources mentioned or linked here are available openly and free of charge.

  1. Preparing the software and tools
    1. Install the PLCnext Engineer software and get familiar with the basics tasks: Getting started with PLCnext Engineer.
    2. Install the PLCnext Technology Toolchain.
    3. Install and integrate your preferred IDE plug-in/add-in, preferably under the path C:\Program Files\PHOENIX CONTACT\PLCnext_Toolchain\ide-plugins”.
    4. Install the SDK for your PLCnext Control device by means of the PLCnext Technology Toolchain or via your IDE workbench.
  2. Preparing the controller and station
    1. Hook up and start the PLCnext Control (see the user manual).
    2. Log in to its Web-based Management and perform a firmware update to the latest LTS release
    3. Shut down the PLCnext Control to attach your I/O modules, then restart the PLCnext Control.
  3. Creating your automation project with a C++ program in it
    1. Open PLCnext Engineer and create a PLC project based on the template for the firmware release on your PLCnext Control.
    2. Create a bus configuration with the attached IO modules; in case of Axioline F modules, see Configuring Axioline F modules.
    3. Start your IDE, create a C++ project (Working with Eclipse or Working with Visual Studio) and create your program.
    4. In PLCnext Engineer, declare the port variables with data types according to the process data.
    5. In your IDE, compile your project and build a library for PLCnext Engineer (Working with Eclipse or Working with Visual Studio).
    6. In PLCnext Engineer, import that library into your automation project.
    7. Instantiate your C++ program from that library, then assign the C++ port variables to the process data.
    8. Transfer your project to the PLCnext Control and execute the C++ program.

Reference

 

 

 


• Published/reviewed: 2025-02-17  ☃  Revision 077 •