LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading measurement data while shutter is open

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?

Download All
0 Kudos
Message 1 of 7
(3,609 Views)

I don't understand why people insist on programming with LabVIEW when they don't take the tutorials.

http://www.ni.com/academic/students/learn-labview/

0 Kudos
Message 2 of 7
(3,573 Views)

Even though I'm very inexperienced, I have gone through tutorials. I'm stuck now. That's why I'd appreciate some help.

0 Kudos
Message 3 of 7
(3,561 Views)
If the shutter button is a real button and you have some external daq hardware you could set up a daq event so your program (which would be event driven) would basically sit static until the button is pressed and then it would start doing whatever it is that you need done.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 7
(3,550 Views)

Is there a way to do it without having to rewrite the program with an event structure?

0 Kudos
Message 5 of 7
(3,534 Views)

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

0 Kudos
Message 6 of 7
(3,519 Views)

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.

0 Kudos
Message 7 of 7
(3,515 Views)