LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I pause a program in LabView with an external digital line?

Hello, this is my first time in a forum and the problem I have is that I have developed a Vision Builder application and have migrated the application to labview.  I am using some slides to move a PCB around so a camera can take the correct picture of the PCB and analyze it.  I need to use external sensors so if an operator happens to place his/her hand near the slide the program has to Pause, and wait for a resume button to continue with the program. 
I don't know how to set an interrupt so that it constantly monitors a digital input line from the sensors with a USB-6009. 
0 Kudos
Message 1 of 7
(3,033 Views)
 

I'm not sure what kind of architecture the vision builder created for you.  I would recommend you setup a state machine.  You can have the digital line of the USB monitored inside each iteration of the while loop.  When that line goes high, you change states to an Idle state until the user hits the continue button.  You interface with the USB-6009 using the daqmx driver.  Just monitoring a single line on the board is a very simple function.  Look at some of the shipping examples to see how to do this.

For information on state machines see:  https://www.ni.com/en/support/documentation/supplemental/16/simple-state-machine-template-documentat...

or:  http://zone.ni.com/devzone/cda/tut/p/id/7595 

SteveA
CLD

-------------------------------------
FPGA/RT/PDA/TP/DSC
-------------------------------------
0 Kudos
Message 2 of 7
(3,027 Views)

With DAQmx you can also use events. This is especially useful if you have a producer-consumer architecture. The producer loop has the event structure that responds to button presses, as well as the DAQmx event. The consumer loop is the one that's doing the work. You can get an overview of DAQmx events here. There's also a couple of examples the ship with LabVIEW.

 
0 Kudos
Message 3 of 7
(3,022 Views)
Daq events would be great too.  However, I don't think the USB-6009 supports daq events. 
SteveA
CLD

-------------------------------------
FPGA/RT/PDA/TP/DSC
-------------------------------------
0 Kudos
Message 4 of 7
(3,014 Views)
Darn. That's too bad.
0 Kudos
Message 5 of 7
(3,008 Views)
Would a parallel polling loop that looks at the digital input and updates a control work in conjunction with an event handler in another loop looking for control's property value signaling change work?
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 6 of 7
(3,005 Views)
If this is a safety issue, you should stop the slides with hardware. In particular a software timed DAQ device like the USB 6009 is a very weak safety system. Use the software to monitor the status of the hardware and pause the program or put a warning on the screen.

The parallel loop should work. You could also use a queue or notifier to pass the data to the state machine.

Be sure to put in some status and error checking. You do not want the thing to continue running because the USB device got unplugged.

Lynn
0 Kudos
Message 7 of 7
(2,957 Views)