LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start/Stop button and crashing

Hello!

I am trying to modify ready .vi that came as a driver with a monochromator that I use. So I have snatched some of the stuff from that .vi and modified it how I need. Now I am trying to add a Start/Stop button that I found as a solution here in forums. When I put in random number generator or any other task in this case structure, the button works fine. When I put in my actual program, the labview crashes.

I presume I have done something wrong when just copying the stuff from that driver, however my program works by itself, but not in this scenario. How can I tell if there is something wrong with call library function node and what should I fix?
I am not too experienced with GUI programming and programming in general, so sorry if this is a rookie mistake.

 

0 Kudos
Message 1 of 7
(1,483 Views)

Hi Arturs,

 


@ArtursK wrote:

Now I am trying to add a Start/Stop button that I found as a solution here in forums. When I put in random number generator or any other task in this case structure, the button works fine. When I put in my actual program, the labview crashes.


Please explain what exactly happens when "LabVIEW crashes"!

 

When that button os FALSE your VI will just burn one CPU core for no good reason. Why is there no wait in the FALSE case?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(1,478 Views)

Thank you for your answer!

If I run the VI, it's running and there are no issues (false case). As soon as I press ''Start'' and it starts executing the program I want, the LabView freezes and I have to kill the program.

Would just ''wait'' work?

0 Kudos
Message 3 of 7
(1,438 Views)

Have you verified that the original vi runs properly?

0 Kudos
Message 4 of 7
(1,430 Views)

The only things in the loop are an eight second pause and the call to sls_SetWlAsync. If the program is actually crashing, as in causing Windows to show an error and ending execution, then the problem is likely with your DLL or the way you're calling it. If the program is just hanging, it could be that your DLL call is taking a long time to execute, or the parameters you're putting in your controls are resulting in many iterations of the loop, which will always take at least eight seconds for each iteration.

0 Kudos
Message 5 of 7
(1,410 Views)

The "wait" suggestion is to fix a problem you haven't noticed yet.  (If you want to see it, open up task manager and look at performance while you're running the false case.  You'll see a core go to 100%)  It fixes that problem but not the one you're currently concerned with.

 

If it's freezing up, that's not a crash.  It's a hang.  That's why a description of the behavior was requested.  As a first step, I'd start the program, turn on highlight execution, and watch where the block diagram stops responding.  It'll help you narrow down what part of your VI is causing the hang.  With that, ask for some guidance if you can't figure out what's happening 😃

0 Kudos
Message 6 of 7
(1,405 Views)

@ArtursK wrote:

 

I am not too experienced with GUI programming and programming in general, so sorry if this is a rookie mistake.

 


Its not GUI programming, but graphical programming! The GUI is the front panel which is almost irrelevant here.

 

Are you using LabVIEW 32bit or 64bit? The dll name almost suggests that it is a 64bit dll, so make sure your LabVIEW bitness matches. Hard to tell. Where did you get it from?

 

As for graphical programming, you already got some good suggestions. You are way overcomplicating things, though. There is probably no need for the convoluted boolean handling with shift registers and such. Learn about mechanical action settings instead. All you need is a simple state machine with one outer loop and one case structure. Also try to figure out why your code has the measles (all these red coercion dots indicate mismatch in representation. Figure out why). It also helps to have reasonable default values for all controls. If you would tap into the wire right after the shift register, you would not need to subtract the step before the loop. I would recommend some of the learning resources listed on the top of the forum.

0 Kudos
Message 7 of 7
(1,392 Views)