04-09-2020 02:32 PM
Hello Guys,
I am new to labview and working on a daqmx project, where I am trying to read & Log Data based on the user input. I have hit wall and would appreciate some assistance and pointers.
I am trying to call a SubVi that performs a DAQmx read function and display the output into a waveform into the main VI, but i am unable to display the data into the mainVI waveform, but everything works fine in the SUBVI.
I am keeping these VI separate because i would like to create another sub VI with a producer consumer design pattern for logging the data.
Thank You
Solved! Go to Solution.
04-09-2020
05:09 PM
- last edited on
05-12-2025
03:18 PM
by
Content Cleaner
It is sounding like you didn't pass the data through the connector pane. I am on my phone, so I can't verify by looking at your code.
As far as logging, you can have DAQmx stream your data to a TDMS file. It is a lot faster than a Producer/Consumer.
04-09-2020 05:16 PM
Your Read Data.VI has a while loop in it that runs until some presses the stop button. That can't be done since the subVI probably doesn't show its front panel. Thus the VI never stops until you abort it.
You seem to have missed the lesson on LabVIEW dataflow.
I would recommend you learn more about LabVIEW from here. How to Learn LV
Get rid of the while loop in the subVI. The initialization and closing of the DAQmx task doesn't belong in there either. The belong in the initialization and clean up sections of your main VI.
You should also get rid of the Quit LabVIEW function. That is the same thing as aborting your VI.
04-09-2020 05:20 PM
Hi. Thanks for the reply. I did wire the connector pane to pass the data. I also tried different terminal to see if it made a difference.
for the logging i am going to stream into a tdms file but use the producer consumer to pass the data so I do not miss any data when logging at a high rate.
perhaps I am doing something wrong.
04-09-2020 05:34 PM
Thanks for the response. I feared that was the mistake but didn’t know how to fix it.
Thanks for the pointers.
04-09-2020 05:52 PM
So looking back at this, do i have the right design pattern? Should i be using an event driven producer/consumer?
I want to continuously read data once the Start Acquisition Button is clicked, but i also want the UI to be responsive incase the User clicks Stop Acquisition.
04-09-2020 05:54 PM
You could put the data acquisition in a separate loop and do producer/consumer. You can leave it in the same loop as long as you have a state that is consistently called to read data.
04-09-2020 06:28 PM
So, I implemented the fix and put a state that is consistently called to read data. the problem now is that the Stop Acquisition button is not responsive because it never goes to the state that checks the events. How do i fix this? Do I consistently check for the stop Acquisition button in my read data case?
04-09-2020 07:29 PM
That's because your Read Only state just loops back to the Read Only state. (Why is it called "Read Only"?)
Have the event structure loop back to the read only. Check Events, Read, Check Events, Read. The timeout case of the event structure would call the Read State.
You have a lot of unwired tunnels on your event structure can state machine case structure. Right click and uncheck "Use Default if Unwired". Then make sure you connect a wire in every case. You don't want to risk losing data on a wire which is what will happen with your Settings Detail indicator.
04-10-2020 08:16 AM
Thanks. Am I going to be loosing data if keep switching my state ? When it goes to check events, it is not going to be reading the daq so would i loose data for that tiny ms/us ?
I named it read only, just to keep track of what I was trying to achieve.
I have to have 3 different Functionality.
1) Just read the data
2) Read and log at a user specified time
3) Read and log every sample at a user specified rate & samples/secs. This would be high frequency. I am looking at abt 7500 S/s.