LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

My app works in the dev environment but not as an exe.

I have a labview application that control multiple hardware devices ( DMM, scope, switch).  I'm using an IVI instrument specific driver to control the DMM (Keithley 2015 THD).  I can talk to and control the DMM from the development environment but when I create an executable it doesn't work.  I can talk to the DMM but it's like it's ignoring the commands I'm sending to control it.  I've never used an IVI driver before but I think I have everything I'm supposed to have.  Plus the weird thing is that the exe doesn't work in the SAME development PC.  I can't really understand what's going on.  Is the exe looking for the IVI drivers somewhere different than the development environment?  If so, how do I find out what's missing and where it is?

Any help is greatly appreciated.

0 Kudos
Message 1 of 12
(3,658 Views)

Are you using "Current Vi's path"? If you are running in an exe, the path of the exe forms the beginning of the result, so you get a different answer in the exe as compared with running in the development environment.

 

You can read more in this thread

 

Rod.

 

Message 2 of 12
(3,644 Views)
Hi Rod, Thanks for your response. The IVI driver that I downloaded from the Keithley website is using "Current Vi's path" but it is stripping to only get the name of the vi. This is only being used for error handling purposes. I am not using "Current VIs path" in my application. What else do you think it could be?
0 Kudos
Message 3 of 12
(3,622 Views)

Have you tried the executable on a different PC, or only on your development PC?  If only on the development PC, do you still have LabVIEW running when you launch the executable?  If so, is it possible LabVIEW has already opened the port or device, preventing your executable from accessing it?

 

I know, really basic questions... but I make this sort of error all the time.

 

Also, have you added error handling to your executable so you can see if anything is going obviously wrong?  You can debug an executable by setting the appropriate key in your .INI file; instructions on how to set this up are in the LabVIEW help.

Message 4 of 12
(3,616 Views)

Hi nathan,

Thanks for your response.  Yes, I have tried running my exe in both my development PC and on a clean PC by using the installer.  It behaves the same in both places.  I've also ran the exe with Labview environment close but it makes no difference.  I guess I should start by aksing what are you supposed to do when using IVI drivers.  I just basically treat it this driver as a normal VXI driver except that I included the .dll file in my project so I can later on included in my exe and my installer.  But I've been reading around and it seems that I'm supposed to "import" the driver so Labview can create wrappers around it??  I'm not sure how to do this.  Maybe someone can help me with that and by doing the whole process properly from the beginning I might fix what's broken.

0 Kudos
Message 5 of 12
(3,607 Views)

In the development environment, where is the application looking for the dll? It has been a while since I've used IVI but in the past, I did not place the dll in a project or have an installer place it a data folder. When I distributed an app that used an IVI driver, I ran the original installer for the driver so that it would place it in the correct location. This used to be in the VXIpnp folder but I think this may have changed.

 

If you have a data folder with the dll in it, try removing it. On the other hand, if you don't have a data folder with it in it, try creating the folder in the same folder that the exe is in.

Message 6 of 12
(3,595 Views)

Hi Dennis,

The driver that I'm using I downloaded from the Keithley website and is for the DMM 2015 THD Model.  I installed the drivers which puts the appropriate files under the C:\VXIpnp\ folder and the ke2015.llb file under C:\Program Files\National Instruments\Labview 8.5\instr.lib\.  I always copy my library files(.llb) into my application directory so I can bring them in with the executable when I'm building and packaging the application (should I not do this?).  In my previous post I stated that I had the .dll file from the C:\VXIpnp directoy in my application directory.  I did this cause I thought I needed to include the DLL with the executable but apparently that is not the case.  So right now all the files are on their appropriate directories:

.fp, .dll, .h files are in C:\VXIpnp

But I still have the issue of the exe not working.  I should mentioned that I'm controlling other devices using regular VXI drivers and they work fine in the exe.  Only the IVI driver device is giving me issues.

0 Kudos
Message 7 of 12
(3,586 Views)
Maybe my problem is related to the configuration setup for the IVI driver in MAX??  I read in a few places that I'm supposed to configure a logical name for my device.  But my driver is not listed in the Driver Session dropdown.  I'm not sure what I'm supposed to do in the MAX setup.  Could this be the problem?
0 Kudos
Message 8 of 12
(3,585 Views)
That could explain the problem on the new pc but not on the development one.
Message 9 of 12
(3,561 Views)

So I got additional info on what's happening in my program.  I used NI-SPY (never used it before... don't know why cause is a pretty good tool) and I found out that the VI that is configuring my device using the IVI driver is closing the reference to my device when it gets unloaded.  This is not desired in my program.  Let me explain a bit more what I'm doing...

I have a custom test manager.  It comes up and it opens sessions for all HW devices connected.  I do this by calling a set of configuration VI's by reference (passing in their name) for each instrument.  When I'm done initializing I close the reference to the configuration VI.  With a normal driver this leaves the open reference to the HW in memory and I use it later to do my measurements without any problem.  However, this doesn't work with the device using the IVI driver.  As soon as the configuration VI leaves memory so does the HW reference created.  I can even see a viClose being executed in NI-SPY. 

I also discover another interesting behaviour.  In the development environment if I open the reference to the IVI driver let say for GPIB0::16::INSTR then it returns GPIB0::16::INSTR(1) as a refnum.  If I go back and manually select the refnum name from the resource name list on my measurement VI then the VI works properly even if the original configuration VI is closed.  Apparently this IVI driver device needs the refnum NOT the resource name to be passed into it in order to work.  Does anyone know how to pass in the refnum vs. the canonical visa resource name?? 

I hope I explain myself properly... cause it's kind of complicated.

0 Kudos
Message 10 of 12
(3,535 Views)