LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication Beckhoff TwinCat - LabView (ActiveX)

You can also find a complete LabVIEW library for communication with Beckhoff TwinCAT here:

www.ackermann-automation.de/tcadslv.htm

0 Kudos
Message 11 of 28
(7,113 Views)

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

Message Edited by Rene24 on 10-04-2009 03:24 AM
0 Kudos
Message 12 of 28
(7,000 Views)

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

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 13 of 28
(6,986 Views)

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!

Message Edited by Rene24 on 10-05-2009 02:35 AM
0 Kudos
Message 14 of 28
(6,976 Views)

@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.

 

Download All
0 Kudos
Message 15 of 28
(6,958 Views)
notti - would it be possible to get your vi's? i am having a difficult time reproducing the same vi's as you have shown that work.
0 Kudos
Message 16 of 28
(6,564 Views)

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. 

0 Kudos
Message 17 of 28
(6,208 Views)

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 

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 18 of 28
(6,180 Views)

Please email me the .net vi's

 

johnfarrugia@primus.ca

 

 

Thanks!

0 Kudos
Message 19 of 28
(6,173 Views)

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.

0 Kudos
Message 20 of 28
(4,206 Views)