LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help configuring Call library function node

Solved!
Go to solution

Hello, I'm trying to control a probe station with LV11 on 32-bit windows 7. 

The user interface provided by the manufacturer has a .dll file from which I would like to call some functions.

The functions I'm mainly interested in are RegisterProberApp, CloseProbeApp, which must be called at application startup or shut down respectively, and DoProberCommand to send the desired commands (command MoveChuck for starters).

However I have no previous experience with .dlls and very little with C and I'm having trouble configuring the parameters of the functions,I tried several alternatives bit I keep getting error 1097 

 

Error 1097 occurred at Call Library Function Node

Possible reason(s):

LabVIEW:  An exception occurred within the external code called by a Call Library Function Node. The exception might have corrupted the LabVIEW memory. Save any work to a new location and restart LabVIEW.

 

I've attached ProgrammerTools.pdf (the functions i'm interested in are in page 17), PBench4-RemoteManual.pdf (command MoveChuck is in page 30) and a vi with one-of-many attempts to configure Call library function node, all of which with no success...

I would really appreciate any help and suggestions.

Thank you.

 

 

0 Kudos
Message 1 of 10
(5,005 Views)

I actually just read a blog post that might be helpful for you:

 

http://www.bloomy.com/support/blog/easing-development-dlls-labview

Message 2 of 10
(4,967 Views)
Solution
Accepted by topic author cocopa

This one says me 

PB_VEE.h The declaration of the functions variables in the msgserve.dll is as follows:
int __stdcall RegisterProberApp(char*, char*, int);
int __stdcall DoProberCommand(char*, char*)
int __stdcall CloseProberApp()

Calling convention is stdcall, not C as in your configuration. DLLs usually return int error code, output strings are passed to the calling environment via a pointer to a space, that will fit this response.

char pcRsp[64]; // leave ample room for response string

int nErrorCode = DoProberCommand("ReadChuckPosition Y C", pcRsp);

So my guess command call will be

int32_t DoProberCommand(const CStr Command, CStr Response);

call command.png

For RegisterProberApp "Int" is int32, not int8

int32_t RegisterProberApp(const CStr AppName, const CStr GroupName, int32_t Flag);

call register.png

 

Also: For type conversion and examples for many types, check Call DLL.vi in examples for "Call Library function node".

Also: Do not put dll into system32: it will be difficult to share your code, system32 will turn into a can of garbage, it will be difficult to configure application build and include all subdlls that are called by main one. Keep sourcedlls in project folder.

Message 3 of 10
(4,962 Views)
call command.png

Another option, instead of using Initialize Array, is to define a minimum length for the string when you configure that parameter in the Call Library setup dialog.

 

call register.png


Don't put the '\0' in there, it could cause problems. It looks like you're trying to put a null at the end of your string, but to do that you would need to remove the single quotes, and anyway LabVIEW will null-terminate a string passed to a DLL for you so you don't need to do it manually (unless you're passing the string as another data type, such as an array of bytes).

Message 4 of 10
(4,951 Views)

I took a very quick look at the Programmers Tools.pdf and guess what, in chapter "6.5 National Instruments LabVIEW Versions 5.X and 6.X" they describe a VI library they have apparently available that does already what you are trying to do.

 

Is there any reason that you are trying to reinvent the wheel here? 

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 10
(4,935 Views)

Thank you all for your help, I'll try your suggestions and see what happens.

 

@rolfk

There is a (really old) application development kit which supports Labview, among others, but in order to install it, the PC must have labview 5 or 6 and we are using LV11. There are no VIs in the installation to disk in order to ask someone to translate them to a newer version.

Also, that department of the company has been sold since and the applications engineer of the company that bought it didn't have VI library available. The system is old, obsolete and there is little support for it, so the only option left for me was to develop my own code.

0 Kudos
Message 6 of 10
(4,919 Views)

Seems like a stupid installer, which checks specific locations on disk to install it's addons in. Instead it should either detect any LabVIEW installation (it can be done by checking the registry), or simply prompt for a location to copy the files to. Yes LabVIEW versions after 8.2 can't read VIs from version 6.0 and earlier directly but that would be a simple thing to overcome with the version conversion board on here.

Is that software somewhere downloadable? I do have 6.0 installed on a machine so it should be able to get the library.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 10
(4,901 Views)

Hello again Rolf, I've uploaded it in my dropbox account, you can download it from this link

https://www.dropbox.com/sh/klrpl1osz0qohja/AAA13N0YRfy4pVDntEe2G_Cua?dl=0 

I would be really grateful if you could extract the library, you would be saving me from a lot of trouble.

Thank you for your time.

0 Kudos
Message 8 of 10
(4,888 Views)
Solution
Accepted by topic author cocopa

Recompiled for LabVIEW 7.1. I didn't really check the VIs in detail but the three main VIs you were trying to reimplement seem to be configured correctly. Also not sure but the two LLBs seem very similar, the SussProberIF_50.llb seems a smaller and probably older version of the library, with the SussProberInterface.llb sporting the newer SussMicrotec logo on the front panel instead.

Rolf Kalbermatter
My Blog
Download All
Message 9 of 10
(4,881 Views)

Alexander and Rolf thank you for your help, both of your solutions worked!

0 Kudos
Message 10 of 10
(4,864 Views)