Dear colleagues. There was a need to transfer the value from a program written in the C ++ programming language to the WinCC environment, namely to Para. Tell me, please, is there a simple solution when using the API functions? I found this design in the documentation:
dpSet (const DpIdentifier & dpId, const Variable & value, const ManagerIdentifier & target = eventId);
Maybe there is an example of using this function? Thank you in advance.
C++ dpSet API
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: C++ dpSet API
If you want to write information which shall be accessible by other WinCC OA processes you have to make a dpSet() to a datapoint element.
When are using an own API manager based on the WinCC OA API toolkit you can use the function dpSet().
Best Regards
Leopold Knipp
Senior Support Specialist
When are using an own API manager based on the WinCC OA API toolkit you can use the function dpSet().
Best Regards
Leopold Knipp
Senior Support Specialist
- Nikolay
- Posts:34
- Joined: Tue Aug 21, 2012 7:10 am
Re: C++ dpSet API
You understood me wrong. I am writing a program in pure c ++. What libraries do I need to connect and what parameters should I pass to the dpSet function to write to Para?
#include "stdio.h"
#include "wincc_lib" // ?????
int main () {
int a = 5;
dpSet("dataPoint", a); // ?????
return 0;
}
Please show an example. We already studied at an advanced course, but still did not understand how to do it.
#include "stdio.h"
#include "wincc_lib" // ?????
int main () {
int a = 5;
dpSet("dataPoint", a); // ?????
return 0;
}
Please show an example. We already studied at an advanced course, but still did not understand how to do it.
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: C++ dpSet API
If you want to implement functionality in C++ you can write an own API manager or a C++ extension.
Both possibilities are based on the API toolkit.
For details please have a look at the WinCC OA Documentation, e.g. Special functions --> Control Extensions.
Best Regards
Leopold Knipp
Senior Support Specialist
Both possibilities are based on the API toolkit.
For details please have a look at the WinCC OA Documentation, e.g. Special functions --> Control Extensions.
Best Regards
Leopold Knipp
Senior Support Specialist
- Nikolay
- Posts:34
- Joined: Tue Aug 21, 2012 7:10 am
Re: C++ dpSet API
I don't need c ++ functionality inside wincc shell. Quite the contrary. I need to pass a value from a c ++ program (developed in visual studio or borland builder) to wincc.
- gschijndel
- Posts:376
- Joined: Tue Jan 15, 2019 3:12 pm
Re: C++ dpSet API
To write a value to WinCC OA you will need a WinCC OA manager, which has a connection to the data & event managers. This can be an existing manager like ascii, control, driver or your own special API manager (Documentation -> Add-ons -> API).
Depending on your requirements you can choose what is the best option for your situation.
If only a few values need to be written you could start the ascii manager for each value you want to write and use the direct set mode (-set option).
If a high performance is required an API manager or a northbound 'driver' (like OPC UA server) as interface would be the best choice. An API manager has to be recompiled for newer WinCC OA versions (3.17), which would not be needed when using a standard interface.
Depending on your requirements you can choose what is the best option for your situation.
If only a few values need to be written you could start the ascii manager for each value you want to write and use the direct set mode (-set option).
If a high performance is required an API manager or a northbound 'driver' (like OPC UA server) as interface would be the best choice. An API manager has to be recompiled for newer WinCC OA versions (3.17), which would not be needed when using a standard interface.