LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Executable crashes but application doesn't

Hello all,
    This message is in regard to my yesterday's post.I have
attached a zip file.
I tried writing a sample application so that i can navigate across vi's.The vi.zip contains four vi's and a Sample.exe
You can run the single.vi which calls double.vi and viceversa.
Single.vi opens the frontpanel of double.vi and runs it.Double.vi closes the frontpanel of single.vi which called
 it,such that execution is transferred now to double.vi .There is a button provided in these vi's to help
 navigate between these two vi's.This just works fine without a problem/crash.
But when i create an executable for this(Sample.exe) the executable crashes after several tries.
 It would be better if you could also create a new executable with these vi's,rather than using the executable which is
 attached because i might have created the executable wrongly resulting in the crash.
 It would be really helpful,if you could solve this problem.
 Thanks in advance,
  Nalin Pradeep




0 Kudos
Message 1 of 6
(3,208 Views)

The main problem is probably that you didn't include the dynamic VI into the build (Source Files in the app builder). When you call VIs dynamically you have to make sure yourself that the exe can open them. Also, when you have an exe, the exe acts like a directory, so to get the path of the directory where the exe is in, you need to do another strip. You can tell you're running an exe by using the App.Kind property.

In addition, your VIs are pretty messy. I'm attaching the Close VI after a couple of minutes of work. Note the changes I made. There can probably be some more. You should also do error handling. That will help find your problem points.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).

___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(3,181 Views)
 Hi tst,
 Thanks for your reply.
 I had single.vi as my top level vi ,and included the three other remaining vi's as dynamic vi's.Also
 i modified my code by stripping the path twice ,as suggested by you.
 But still i have the same problem,the executable crashing after several tries.
 To see the crash,you can run the exe and continuously press tab & enter key such that it goes
 back n forth between single.vi & double.vi
 The vi's when run separately as such do not crash at all,it's only the executable which crashes.
  I have attcahed zip file which contains these vi's corrected and it's executable.
  Hope you could help me solve this problem.
 
 Thanks
  Nalin
 

0 Kudos
Message 3 of 6
(3,158 Views)

I think the crash comes from a sort of race condition. Here is what you do:

  1. Call the open VI to open VI B.
  2. End VI A by wiring T to the stop condition.
  3. Inside VI B call the close VI to terminate VI A.
  4. Inside the close VI you open a reference to VI A, close its FP, wait and close the reference.

My guess is that on occasion the reference opened in step 4 becomes invalid because of the ending of the VI in step 2 and when you try to close it, it crashes the RTE.

Placing a wait before running the Close VI seems to solve this, which is why I think this is the case, but that's just a guess.

In any case, it's very important that you follow the things I talked about in my last post. For example, in my modified close VI you added a strip path, but you didn't rearrange the code to look clean. Also, in both cases, your VIs won't work when you run it from LV. I told you how to solve that. You should also note that this way it will only work if the VIs are located in the same directory as the EXE, which is not a good way of doing this. You also need to have some error handling, so you can monitor the data and know when something has gone wrong and where it has gone wrong.

In addition, I have to say that I still don't understand what these VIs are supposed to accomplish. As another suggestion, Instead of having the second VI close the first, let the first call the second and then close itself.


___________________
Try to take over the world!
0 Kudos
Message 4 of 6
(3,144 Views)
Hi tst,
Thanks for your suggestion.I figured out the crash.
The event structure i used in the code needs the option "Lock Frontpanel for this event" unchecked.
Since i close the vi and open another one, it keeps it locked and some memory is mishandled.
Also i just posted sample application where one can navigate between couple of screens.
I'm actually developing an application with 10 User Interface screens doing quite some work
,where i have to navigate across them.
Also i'm trying to make my vi's clean as you suggested,still working on developing clean applications.
Thanks once again for your help.
One more clarification,I use LED's in my vi.They blink with Red color in my application which
 was set from tools->options->colors->Blink foreground/background.
 But my executable makes it to blink in yellow color.Any advice on this ?

-Nalin

0 Kudos
Message 5 of 6
(3,142 Views)

First, if you have that option in the menu of the EXE, set it there.

If you don't, search you LabVIEW.ini file and see if you can find the line that determines the blink color. If you do, copy it to the EXE's INI file.

If you can't, search the site for any or all of the following terms "labview, blinking, executable, ini" or search google for Brian Benken. He has a site with the list of INI settings.


___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(3,128 Views)