LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need help with LabVIEW RT and DLLs

Solved!
Go to solution

Hello!

 

I'm new to LabVIEW but I have to deal with some very difficult stuff.

 

I am developing with LabVIEW 2012 on a cRIO-9082 and I would like to use a specific DLL in a VI. The DLL is called TcAdsDll.dll and it is used for communicating with an PLC. (This DLL is provided by Beckhoff, for more information: http://infosys.beckhoff.com/index_en.htm TwinCAT > TwinCAT System > TwinCAT Connectivity > TwinCAT ADS).

 

When I use the "Call libary function" with the DLL, I get an Error 7. I'm just trying to call a simple function from the DLL.

 

I know, that in LabVIEW RT (Pharlab) only some DLLs are supported. I also checked the DLL with the tool from NI, but after calling the 10th dependend DLL it just crashes.

 

If anyone is able to provide some help, I would be very thankful!

 

Does anyone know, which rules for DLLs must be fullfilled to use them in LabVIEW RT?

 

Thanks in advance!

 

0 Kudos
Message 1 of 4
(3,959 Views)

Is the DLL c based or .NET based?  Your method will only work if the DLL were C based.  You have to use Connectivity -> .NET pallette if the DLL is .NET based.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 4
(3,926 Views)
Solution
Accepted by topic author hoestreich

A DLL must in the first place only call Win32 APIs that are supported by the Pharlap ETS system in question. Since NI keeps updating the ETS system with almost every new LabVIEW version this actually varies. The DLL Checker Tool is the only way I know of to check for this. If the DLL Checker Tool shows failures or as in your case crashes, the DLL is not supportable on that RT system. The Beckhoff ADS DLL is a complicated beast with many dependencies on other Beckhoff DLLs and what else and as such a bad candidate to run on the NI RT systems.

 

In addition to this basic issues you run into additional issues with the C runtime library. Microsoft in its infinite wisdom decided to create a new C runtime library version with every new Visual C version. This is already a problem for a developer when deploying to standard Windows PCs but gets an almost unmanagabel issue when targeting something like Pharlap ETS. NI seems to have ported the MS C runtime for their Visual C toolchain version of choice to the LabVIEW RT system but that is not an option for you. If the 3rd party DLL you want to use was compiled in a different Visual C version than what NI used for the RT version you want to use, then you run almost surely into trouble, unless the DLL was created with Visual C 6.0 (by now a really ancient version)!

 

I have created in the past an entirely VI based LabVIEW ADS communication library. It was a tedious work to find out about the actual byte stream protocol. Unfortunately it is not something I can share  with the community.

 

Your best bet would probably be to use the cRIO Ethercat solution and go with an Ethercat interface on your PLC. Ethercat is sort of a superset of the ADS interface.

 

Maybe you can also talk with these guys. They have some ADS LabVIEW library and Ethercat libraries too. Not sure if they are DLL based and if they would be compatible with LabVIEW RT though.

Rolf Kalbermatter
My Blog
Message 3 of 4
(3,917 Views)

Thank you very much for all this information!

0 Kudos
Message 4 of 4
(3,893 Views)