PLCnext Technology - CppExamples
The CppExamples repository is a collection of various sample code for PLCnext Technology controllers.
It is assumed that the reader has basic know-how of C++ programming and has read the PLCnext Technology User Manual.
Each example explains one or more topics on how to use C++11 with PLCnext Technology. Explanations are given in the README.md document and via comments in the example code. Each example holds separate user components which can be instantiated on a PLCnext Control.
This project aims to supply, over time, examples and best practices of PLCnext Technology functions regarding C++11.
Table of Contents
|01||Program Component Interaction||This example shows two PLCnext programs interacting with a PLCnext component by getting or setting variables through reference.||SourceCode|
|02||Data Type Exchange Example||This example shows how to transfer data from a C++ project to the GDS. Variables published to the GDS can be accessed by other programs (IEC/C++/Simulink/C#) or the IOs||SourceCode|
- PLCnext User Manual
- Tutorial video: tool installation on Windows
- Tutorial video: tool installation on Linux
- Tutorial video: First Cpp project
Compiling an example
There are different ways how to build your code:
Compile the code with the PLCnext CLI
- Install Eclipse IDE, CLI, SDK and Eclipse Add-in (how-to guide: see links in the "Getting started" section above)
- Clone this repository
- Navigate to the project you want to test, e.g.
plcncli new project -c DummyC -p DummyP && ls -la src && rm src/Dummy*
plcncli generate allto generate intermediate code and Config files
plcncli buildto build the code.
plcncli generate libraryto generate a .pcwlx file that can be included in PLCnext Engineer
Compile using the Eclipse Add-in
- Create a new empty project named like the example you want to test
- Remove the source files located at
- Move the source files from the example you want to use into your workspace at
- Build the project
You can participate in this project by submitting bugs and feature requests.
Furthermore you can help us by discussing issues and letting us know where you have problems or where others could struggle.
- Ask a question in our Forum
- Request a new feature or example to be added on GitHub
- Vote for Popular Feature Requests
- File a bug in GitHub Issues
Copyright (c) Phoenix Contact GmbH & Co KG. All rights reserved.
Licensed under the MIT License.