Giter Club home page Giter Club logo

cppexamples's Introduction

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
03 Include an Open Source Library This describes how to use a third-party open-source library in a C++ project that is built for PLCnext Control using Eclipse
04 Thread Example This describes how to implement Threads in a component of C++ project. SourceCode
05 Notification Example This describes how to use the Notification Manager. 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

Compile using build-local.sh script

  1. Clone this Repository
  2. Modify the build-local.sh script to fit your needs
    1. select Hardware
    2. select Project
  3. Make sure it is executable for example with chmod +x tools/build-local.sh
  4. Execute the script ./tools/build-local.sh or sh tools/build-local.sh

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.

cppexamples's People

Contributors

owarneke avatar emuenz avatar g-breder avatar mluhmann avatar martinboers avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.