07-21-2009 06:25 PM
You can also find a complete LabVIEW library for communication with Beckhoff TwinCAT here: |
10-04-2009 03:15 AM - edited 10-04-2009 03:24 AM
Im trying to communicat between TwinCatPLC and Labview8.2. Im using the ActiveX component. The Examples from Beckhoff are worimg. But i have to pass arrys between the two interfaces. This doesen't work!
@ Kenneth
How did you slove the iusses with passing arrays between Beckhoff and Labview? Passing integer or bool between the two interfaces works but not arrays. Could you post me a example how it works?
Regards
Rene
10-05-2009 01:12 AM
Hi
It may not be exactly what you need but it makes the job very well and you don't have do deal with the ActiveX .
I ofthen youse the call libraray function methode for communication via ADS with the beckhoff components. Either per handle or per adress and offset.
I use in princibple the following methode which is suitable for every datatype in reading and writing direction.
Only in case of eventing I use either .NET (still amemory leak within LV 2009) or ActiveX which is fine.
I convert all my data to bytarrays and write it to the PLC with a vi very similar to the attached one. Also for reading I use sometimes this method but not AdsSyncWriteEX but AdsSyncReadEX.
Best regards
Gernot
10-05-2009 02:33 AM - edited 10-05-2009 02:35 AM
I prever working with ActiveX because i don't have to care about the adress. But thx for your post! If I cant handle it with ActiveX I'll try your way!
10-05-2009 07:42 AM
@Rene:
My solution using the ActiveX OCX was not pretty, but it worked for a test stand project. A screen shot is attached. There was a problem between the LV Client and the Beckhoff server with arrays. My understanding was that LV interpretted the interface to pass a single data value. My solution was to store an array as a waveform on the PLC. The array was stored with an element size of the A/D conversion size, I16. I then requested each element as a double value and decoded into the four elements. The PLC waveform also included its scaling factor, dY, similar to the LabVIEW dt scaling factor for the time data.
The LV program also had a calibration routine to scale the A/D voltage values (0..10 V) into engineering units according to the customers calibration equipment.
This example was written 4 years ago and I understand that the array interface between LV and TC was resolved in LV 8.5.
in "TC_LV Waveform Acquire OCX.jpg", the ADS address (index & offset) are defined in the program as constants. The PLC waveform includes elements similar to LV waveforms. The PLC Waveform elements are:
t0 - initial timestamp of acquisition
dt - PLC scan time of DAQ task
dy - PLC scaling factor for waveform
nData - number of elements stored in the array
data - array of (raw) Int16 data, maximum size = 10000
The subVI reads the first four scalars and then loops to transfer each data element. The Int16 size was chosen to minimize data length. Reading doubles for each element of the array results in four Int16 elements. However, the must be extracted from the 8-byte double.
The subVI, "TC_LV Waveform Conversion.JPG", performs a conversion from the PLC Waveform cluster to a LV waveform in order to use native waveform functions in LV.
Regards,
Kenneth
p.s. In my VI, I had implemented the array transfer and conversion in several ways, including methods that only transferred a single value (the built-in array) methods. I have not retested those other solutions with the latest LV-TwinCAT versions.
01-11-2010 09:25 AM
04-15-2010 09:46 AM
You may be interested to ask TwinCAT related questions at the LinkedIn TwinCAT Developers Group: http://www.linkedin.com/groups?gid=1860933
I'm afraid that you will have to joinLinkedIn before you can join the Group. By the way there are also some useful LabVIEW related Gropus on LinkedIn.
04-15-2010 02:21 PM
Joe
I am very sorry but I haven't ralized your post up to now.
In the meantime there are tree prossibilities I use for ADS communication.
ActiveX, .NET and call library function node.
I currently and will use in future the .NET components as NI fixed the memory leak of .NET eventing in LV2009f3 and LV2009SP1.
I can send you some vi's if you want. Please specify your prefered methode.
Hope i am not too late
Best regards
Gernot
04-15-2010 03:54 PM
Please email me the .net vi's
johnfarrugia@primus.ca
Thanks!
03-15-2013 10:36 AM
Hi, i try to use LV2012 to link with BX9000 , using windows XP (32bits) and Windows 7 (64bits), i meet 2 different result.
the 32bits XP, ADS-OCX is support very well,
but the 64 bits windows XP is totaly can't work,
i think it is the TwinCAT problem?
Thanks.