I want to program fully in Visual Studio environment without the need of PLCnext Engineer. I want to program in C++. To clarify what I already did:
At first I looked at the following documentation of PLCnext Runtime: https://www.plcnext-runtime.com/ch01-05-hello-again-world.html
. The problems that I had was that I have a windows SDK but they use a linux SDK. I tried to use WSL to make use of ubuntu command on windows but coudnt run batch files since that is a windows type file.
After that I found this explanation from the Github example projects: https://github.com/PLCnext/CppExamples/blob/master/Examples/NoEngineer/README.MD I have problems when reaching step 5. It seems that the standard PLM project structure has been changed so I don’t know which files I should copy and move into the correct files. Is this even needed anymore. I use the 24.6.0 SDK so it’s newer then the 2021.6 SDK that they used.
Could someone help me what the correct steps are and where this possible might be explained?
I’m one of the maintainers of that project.
It seems like more recent versions of the PLCnext CLI - which is installed with the Toolchain - puts the meta files in a different place to previous versions. The tutorial assumes that the meta files are in the Release folder alongside the lib directory containing the .so file, but in my version of the PLCnext CLI the meta files are in a different place: image.pngI have just run through the tutorial again, and I copied the „config“ folder to the directory /opt/plcnext/projects/Pnd on the PLC, and then updated the pnd.meta.config file to include the correct path to the Pnd.libmeta file. After that, everything worked ok - I tried this with AXC F 2152 FW 2024.0.5 and the corresponding SDK.
It doesn’t really matter where any of the files are located on the device, what matters is that all the paths in the .config files point to the place where the file(s) are located.
Thanks for reporting this - I will add a new Issue to the Github project and update the instructions at some point, probably before the 2025.0-Preview branch is merged into the master around the end of April (when firmware version 2025.0 is released).
Thanks for clarification. I now installed a WinSCP program to easier convert the files. I did moved the config files of Visual Studio to my PLC project. The problem I got now is that it doesn’t generate the following config files in my Visual Studio project PLM:
Thanks for clarification. I now installed a WinSCP program to easier convert the files. I did moved the config files of Visual Studio to my PLC project.</p>[https://forum.plcnext-community.net/uploads/6T2SNAARIKAC/image.png</a></p>The problem I got now is that it doesn’t generate the following config files in my Visual Studio project PLM:</p>
Plm</li>
Esm</li>
Meta</li>
Gds</li></ul>I did saw the following that it generates this in my PLCnext Engineer. [https://plcnext.help/te/PLCnext_Runtime/Configuration_files.htm?rhhlterm=plm%20config&rhsearch;=plm.config</a></p>How could I add these config files to the plc project?</p>
Normally, PLCnext Engineer generates those missing .config files before it sends the project to the device. When not using PLCnext Engineer, those .config files must be generated some other way. The Github project includes examples of those four config files that you can use as a starting point: CppExamples/Examples/NoEngineer at master · PLCnext/CppExamplesCollection of various C++ sample code for PLCnext Technology controllers. - PLCnext/CppExamplesimage.png
The PLCnext Technology Info Center includes some information on the format of these configuration files, here:
Configuration filesAlthough PLCnext Engineer is the recommended tool you can load programs and program instances onto the controller even without using the PLCnext Engineer. This also applies to files in .pcwlx libraries programmed in C++ by using the Eclipse® IDE with PLCnext Technology Add-in, or Visual Studio® with PLCnext Technology Extension, or the PLCnext CLI.
Thanks for the info again. I got everything setup now and don’t have errors in the output log after the reboot.
I was wondering how I could debug my code to see the variables changing?
I am just running this simple calculation to see the difference over time.
Here’s how you can debug your C++ code from Visual Studio: How to debug C++ components and programs in Visual Studio - PLCnext CommunityThis article describes how to debug custom C++ components and programs on a PLCnext Control device using Microsoft Visual Studio.The example in this article uses: AXC F 2152 with firmware version 2022.0.3. Microsoft Visual Studio 2019. PLCnext Toolchain version 2022.0 for Windows, with the Visual Studio extension. Software Development Kit for AXC F 2152 version […] Note:
In the article, the link to the Info Center is broken. The updated link is here
* - see the section „SSH login as root user“ near the end of the page.
* The instruction „Disable the ESM task watchdog by setting the Watchdog value to zero.“, which is usually done in PLCnext Engineer, must be done in the esm.config file by changing the watchdogTime value to „0“. For example: