LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to start data acquisition with user button press

Hello,

I am a student working on developing a VI to control a test bench. One of the requirements is to initiate data acquisition based on a button press by the user. The user should also be able to select the desired channel before starting the temperature measurements. I am implementing a producer-consumer architecture using the Queued Message Handler (QMH) framework. Currently, I have placed the DAQmx Create Channel VI outside the while loop. However, this leads to an issue: if the DAQ device is not connected to the computer, the program continuously throws an error.

0 Kudos
Message 1 of 4
(294 Views)

You could place a Delete Error between your loop and create channel

Actor Framework
Message 2 of 4
(276 Views)

Maybe have an "initialize" consumer case. Create your queue and then add "initialize" before it enters the loops. If you get an error on bootup, clear the error and send your consumer to case that has a dialog to instruct the user to verify the setup, reboot the device, etc. When they dismiss the dialog, re-enter the "initialize" case.

0 Kudos
Message 3 of 4
(256 Views)

@Bonapg wrote:

Hello,

I am a student working on developing a VI to control a test bench. One of the requirements is to initiate data acquisition based on a button press by the user. The user should also be able to select the desired channel before starting the temperature measurements. I am implementing a producer-consumer architecture using the Queued Message Handler (QMH) framework. Currently, I have placed the DAQmx Create Channel VI outside the while loop. However, this leads to an issue: if the DAQ device is not connected to the computer, the program continuously throws an error.


The initialization needs to be inside the loop in one of the states of your state machine (called once first and then as needed).

0 Kudos
Message 4 of 4
(226 Views)