Skip to content
Collection of various C++ sample code for PLCnext Technology controllers.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Examples
.gitignore
.gitkeep
CONTRIBUTING.md
CONTRIBUTORS.md
CodeOfConduct.md
LICENSE
MAINTAINERS.md
README.md
SECURITY.md

README.md

PLCnext Technology - CppExamples

Feature Requests Bugs License Web Community

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

# Topic Content SourceCode
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

Getting started

Compiling an example

There are different ways how to build your code:

Compile the code with the PLCnext CLI

  1. Install Eclipse IDE, CLI, SDK and Eclipse Add-in (how-to guide: see links in the "Getting started" section above)
  2. Clone this repository
  3. Navigate to the project you want to test, e.g. cd Examples/ProgramComponentInteraction
  4. Execute plcncli new project -c DummyC -p DummyP && ls -la src && rm src/Dummy*
  5. Execute plcncli generate all to generate intermediate code and Config files
  6. Execute plcncli build to build the code.
  7. Execute plcncli generate library to generate a .pcwlx file that can be included in PLCnext Engineer

Compile using the Eclipse Add-in

  1. Create a new empty project named like the example you want to test
  2. Remove the source files located at ProjectName/src
  3. Move the source files from the example you want to use into your workspace at ProjectName/src
  4. Build the project

Contributing

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.

Feedback

License

Copyright (c) Phoenix Contact GmbH & Co KG. All rights reserved.

Licensed under the MIT License.

You can’t perform that action at this time.