LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Link SubVI waveform to main VI waveform

Solved!
Go to solution

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

 

 

Download All
0 Kudos
Message 1 of 11
(2,853 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(2,812 Views)

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.

0 Kudos
Message 3 of 11
(2,810 Views)

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.

 

0 Kudos
Message 4 of 11
(2,808 Views)

Thanks for the response. I feared that was the mistake but didn’t know how to fix it. 

Thanks for the pointers.

0 Kudos
Message 5 of 11
(2,804 Views)

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.  

0 Kudos
Message 6 of 11
(2,799 Views)

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.

0 Kudos
Message 7 of 11
(2,795 Views)

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?

0 Kudos
Message 8 of 11
(2,774 Views)

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.

0 Kudos
Message 9 of 11
(2,764 Views)

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. 

0 Kudos
Message 10 of 11
(2,719 Views)