LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional System Exec with Initialization

Solved!
Go to solution

Hi, I'm trying to create a button utilizing the System Exec command; I've created a batch file for initialization and two for start and stop the UV box using a boolean button, but keep getting the No Listener on the GPIB/Memory is Full error. Could anyone help me with this problem/check if my block is per common practice? 


TIA!

VBswUGz[1].png

Mike Nguyen

0 Kudos
Message 1 of 12
(2,762 Views)

It looks like you have a race condition.  The case structure and the UVInit.bat code is running in parallel.  How do you know which will actually occur first?

0 Kudos
Message 2 of 12
(2,727 Views)

To be honest, my experience with LabVIEW so far is self-taught by reading block diagram and reverse engineering some example for the past month; I had utilized the LINX to control a stepper motor, I'm trying to expand it with some additional feature. For the parallel parts, it actually doesn't matter if the Stop command in the case structure by default ran first, as it basically does nothing if the initial file is not triggered and the box has not started, though I'd appreciate any tutorials that would help to put it in the right order.

Later on the case structure would likely be integrated into some other function, I'm thinking about input a controlling timer for it to start and stop when the function is called; I can't provide an example as of right now due to LabVIEW doesn't want to open anymore since I tried to import some DLLs and now it just stuck not responding to anything that I've been trying to figure out.

0 Kudos
Message 3 of 12
(2,713 Views)

I've made some change to the code; I think that this is sequential as I expect it to run the second block after the first one is finished, but I ran to an infinite loop that it keep launching UVStart and open thousands of cmd and freeze my computer because of the while loop (is it necessary?); I'm not sure how I should deal with the situation; I'm thinking about instead of using the switch, I could try to use a button that triggers each system exec, but not sure how and still looking into it.

 

TIA for any guidance!

 

Mike

0 Kudos
Message 4 of 12
(2,700 Views)
Solution
Accepted by topic author MikeNguyen

You still need to learn something about dataflow.

 

Your boolean control is only read once at the very beginning of the VI.  That value will exist at the input tunnel no matter how many times you run that loop and whether you change the boolean or not.

So if it is True, the true case will repeatedly run.  If the boolean is originally false, the false case will repeatedly run.

 

And you have no real control over how the loop stops, or even how fast it runs.  Do you even need a loop?

 

If you do want a button that triggers each situation, then you should have a loop, but also an event structure that has an event for each button press, including a button that handles the exiting of the VI.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
Learn LabVIEW

Message 5 of 12
(2,696 Views)

Thank you very much for the guidance, I'm looking into event structure now; that might be what I end up doing. I currently do have a button exiting the general VI, but not this part specifically; should I have one for every loop in the programs?

I've seen others pointing the error out to the stop button in the while loop; I tried the same but it wouldn't stop and continue with the infinite loop, that's why I might drop one button option.

 

The link you provide is also very helpful, as I do have a MyDAQ laying around the lab for the basics. I'll go through it today and come back with some update.

0 Kudos
Message 6 of 12
(2,675 Views)

Got it up and running roughly as I wanted thanks to your word about event structure and dataflow, thanks!

I'm attaching my current code for future reference

Message 7 of 12
(2,654 Views)

That seems resonable, just add an Event for your Stop button and move the button into that one, and it's a good program.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 8 of 12
(2,645 Views)

Thanks for the comment on the stop button, I added it and it work great.

Now I'm trying to use a matrix to define scalable varying time delay, so I'm using uninitiated matrix to contain data input as I'm unsure of how the array index work in 2-D. Now I'm not sure how to replace the column at the end of the matrix to be indexed to catch the number of loop (cycle) required to run: http://prntscr.com/o6qkc0

 

Could I use a 2-D array as input and get it indexed, then convert array to matrix and use the index value of the array for the last column's location?

0 Kudos
Message 9 of 12
(2,620 Views)

For (most) all intents and purposes, a Matrix and a 2D array are the same. To change a column, just use Replace Array Subset with the column number connected.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 12
(2,611 Views)