Showing results for 
Search instead for 
Did you mean: 

update data from subvi

I have a sub VI thats continuously reads data from a PCIe-6363.  In the main vi i have successfully displayed the data in a waveform graph that is continuously updated with a control reference and property node.  however I need to access the data being displayed in the graph, do some analysis and manipulation then display the data in a second graph.  Everything I have tried to get the data that the main graph is being fed results in the new data display (graph) not updating until exection is stopped.  then as soon as execution is restarted the new graph shows the last data graph and does nothing until main is stoped an started again.


what am i doing wrong?

0 Kudos
Message 1 of 15

could you post your vi? to understand the problem better?

0 Kudos
Message 2 of 15

example code:

Download All
0 Kudos
Message 3 of 15

In your main VI, the time signal local variable is being read, manipulated, and put into the intensity graph only once as soon as your VI runs.  You don't have any while loop around that code so that it can do any more work with the TimeSignal Data as the Time Signal data is updated in your subVI.


Why do you have the second While Loop in your subVI?  It only runs once because you have a False wired to the Continue terminal.

0 Kudos
Message 4 of 15

yes, that is my question.  how do i get a continuously updated local variable of the data in the subvi instead of just the continuously updated graph data?


the second look does not need to be there.  it works as intended... so far...  that is not in question; unless it is causing the problem mentioned above.  are you saying that is the problem?  I tried deleting the second loop but nothing changes.

0 Kudos
Message 5 of 15

Put a while loop around that part in your main VI.


I really don't understand what you are trying to do here.  You could send an reference for the intensity graph to the subVI and do the calculations for that there as well.

0 Kudos
Message 6 of 15

what i intended to do was create a subroutine that will continuously and as fast as possible acquare data from DAQ input.  this data is to be samples and depending on some parameters and analoge output control, tasks will be performed on the input data.


but i can not do any of this because i can not manipulate data locally in the main vi.  i can control the input, i can display the input data aquired, but i can not do anything with the data.

0 Kudos
Message 7 of 15

Creating a subVI is fine, as long as it is helping your solve your problem rather than adding to it.


Since you are trying to run something as fast as possible, the subVI isn't necessarily helping you.  What you need to do is start with the proper architecture such as Producer/Consumer.  The producer is the loop that acquires the data.  It passes it to the consumer processing loop by way of a queue.  The consumer loop processes the data at its own rate and won't intefere with the acquistion of the data in the producer loop.  Of course you want the consumer loop to run at a similar rate as the producer, otherwise if it can't keep up, it will eventually fill up the queue.


You can put the the two loops in different subVI's if you want, but you don't have to.  If you do, you pass the queue reference into the subVI(s) so that you have direct access to the queue.

0 Kudos
Message 8 of 15

interesting.  i understand what you mean by producer/consumer.   well, I am learning labview in the process.  i thought that for efficiency and asthetics i suppose, things would be divided subvi's for tasks that would be performed continuously or separatly in numerous instances.  hence i first made a vi that performs a continuous data aquisition.  also for output, and functions like filtering, etc.  then all of these task would be brought together in a main vi.  the challenge I am having is getting data from one vi into main then feeding it into the next task(vi).


but I suppose this producer/consumer architecture is exactly what i am trying to do.  I have a subvi that produces data by reading from an input, then i want to perform some function on this data (consume), and produce some ouput.  I dont know anything about queueing, is that not what reading data from a buffer is doing?

0 Kudos
Message 9 of 15

@papacode wrote:

I dont know anything about queueing, is that not what reading data from a buffer is doing?

Queuing is nothing more than adding items to the queue (FIFO), in your case in the producer loop.  You then dequeue the element in the consumer loop.

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 10 of 15