10-14-2013 09:46 AM
Hello.
I'd like to connect Simatic PLC Simulator (PLCSim) to LabVIEW via its ActiveX Control. I successfully inserted the ActiveX Object to VI using Automation Open object. I made a Invoke Node to read data from PLCSim. The ActiveX Control uses pointer method to give or get data. In C++ language, the function has defined as following:
STDMETHOD(CS7ProSim::ReadFlagValue)( long ByteIndex,
long BitIndex,
PointDataTypeConstants DataType,
VARIANT* pData)
The first three inputs can be inserted correctly but the 4th input is a pointer. In ordinary languages like C++, you must first allocate memory for a variable and then use that variable as ReadFlagValue's 4th input to read data.
In LabVIEW, the pData in ReadFlagValue Invoke Node has one input and one output and colored in violet.
Now I don't know what I should I set as its input? Can LabVIEW handle pointer data in ActiveX Controls?
10-30-2013 10:50 AM
Hi imanh,
Sorry for the delay in getting a response to you, I'm just letting you know that I'll be looking into this for you now, and will let you know if I find a solution for you.
Whilst I'm trying to work this out for you, if you could provide me with what LabVIEW version you are using, that would be great. If you have any additional information to add please feel free to post back as I will be monitoring the thread now.
Kind regards,
10-30-2013 11:15 AM
Dear Matt,
Thanks a lot.
I am using LabVIEW 2011.
10-31-2013 09:23 AM
Hi imanh,
would you mind attaching your VI as it currently stands so that I can open it in my LabVIEW environment?
Many thanks,
10-31-2013 09:41 AM
I attached the vi. I also included the PLCSim DLL but I am doubted if it works without PLCSim being installed.
Thanks.
11-05-2013 10:28 AM
Hi imanh,
By the sounds of it You're communcating using the feature s7prosim, Have you seen the documentation on this that can be found here?
That manual references pdata and what it is, and might be helpful in understanding its use.
Kind regards,
11-09-2013 09:04 AM
I've read the documentation. I think there is a problem in variable declaration. I can not read data via S7prosim neither with LabVIEW nor with MATLAB. I think it should be used with middle-level languages such as VC++.
Thanks very much for your attention.
11-15-2013 03:33 AM
Hi imanh,
There is a previous thread that is a discussion on how to connect to S7prosim, there are some links on this thread concerning connecting to a PLC that you may find useful.
Kind regards,
11-15-2013 03:50 AM
Thanks!
I used OPC protocol instead and now everything is under control.
11-15-2013 03:59 AM
Glad to know you got it working! If you have found any resources that you found useful in solving your particular problem, it would be great if you could post them on the forum so people can find this solution quickly in the future.
Kind regards,