05-17-2015 11:17 AM - edited 05-17-2015 11:18 AM
I'm new to LabView. This is my first attempt at interfacing with an instrument..
I want the attached program to stop when the shutter is closed after having opened the shutter once - how do I do that without using the stop button? VI and subVI are attached.
Also, the program currently goes through data collection each time the shutter button is pressed. I want it to go through collection only when the shutter is opened, not closed. Is there an easy fix to that?
05-17-2015 03:14 PM
I don't understand why people insist on programming with LabVIEW when they don't take the tutorials.
05-17-2015 04:05 PM
Even though I'm very inexperienced, I have gone through tutorials. I'm stuck now. That's why I'd appreciate some help.
05-17-2015 04:29 PM
05-17-2015 05:25 PM
Is there a way to do it without having to rewrite the program with an event structure?
05-17-2015 06:12 PM
Probably. But why not stop, think about what you want to do, and then design a program to accomplish your goals? Even if it means admitting your initial effort is so wrong-headed that the best thing to do is Start Over! [For what it is worth, I frequently suggest to one of my colleagues that he Start Over -- he's also been completely resistant. Howver, I'll admit that I recently "started over" with a very complex Real-Time project, also designed without a design or a plan, and I'm putting the finishing touches on the complete rewrite, which is more than twice as fast, error-free, much easier to operate, safer to use, etc.).
Bob Schor
05-17-2015 06:13 PM
I can't open your VI at the moment. But I'd guess the answer to your question is no.
Think about what you're asking for.
You need your project to wait until the button is pressed before taking data.
Once it closes, you need the VI to stop.
The first requires either an event structure or "polling." Polling is creating a case structure over your program that you read in a while loop and only execute the code you have now when the value is true. This is a computationally expensive way to do the same thing. It also will only take place while the button is pressed, assuming you read directly from the button.
You want the VI to stop after reading. You need to add a mechanism to handle this. You need something to control the conditional terminal seeing a false until you reach the case you'd like for it to be true so the loop stops. That sounds a lot like a state machine.
You probably can write something incredibly complex to do all of this. Or, you can spend a short period of time moving your code into a state machine with an intialize, wait for events, execute current code, and stop cases.