LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a Waveform Chart from main Vi to Subvi

Solved!
Go to solution

I am trying to take a waveform chart and have it plot the exact same information on a waveform chart in a subvi. Right now the waveform chart is getting the information from a DAQmx Global Channel and the information is being displayed on the waveform chart.

 

I want to pass this information to a subvi along with information from a string that the user will have typed information into. I only want the subvi to run the case structure if the Boolean on the main vi it true.

 

The purpose of the subvi is to automatically save (eventually print) the front panel of the subvi as a jpeg/bmp/png. I've attached the vi file for the sub vi and an image of the main vi. I can't give the file out for the main vi.

 

Image 1 is the front panel of the main vi which is the same information that I want to transfer to the subvi. Image 2 is the block diagram of the main vi with the information being passed to the subvi.

 

The subvi I have the waveform chart and the string input from the main vi as well as a Boolean operator to turn on the control to save the front panel as a jpeg.

 

Right now I can't get any information to transfer to the waveform chart in the subvi and what I am trying to get happen is I run a certain sample and when I go to stop my main vi the waveform chart will have copied the same data to the subvi and the subvi will save the front panel of the subvi as a jpeg.

 

I'm sure I'm missing something extremely obvious but I haven't been able to figure it out using the forum and the NI help.

 

Any help is appreciated, thank you.

 

Download All
0 Kudos
Message 1 of 10
(6,062 Views)

Lots of ways to skin this cat...

 

Use either a Notifier or a Queue (in the Synchronization block diagram palette) and pass the reference of that to your SubVI in one way to do it.

 

I actually have really liked using Shared Network Variables to accomplish this type of task as well.  Using Shared Network Variables has given me a lot of flexibility in that I have a single application aquiring data and publishing them to network variables, and I can have multiple "consumer" applications running on the same computer or any computer on the network that run controls, process and display data, etc.

Message 2 of 10
(6,057 Views)

Here is one of my examples.  Here is a segment of code that shows a producer loop sending data to a consumer loop through a queue (the queue's data type is a 1D array of waveforms).  Part of my consumer loop outputs the data to a Shared Network Variable called "Live Data".

shared variable example.png

 

Here is an example of a seperate application that can consume this Live Data (from this app...or..any app).  This example is a segment of some code that consumes the Shared Variable, passes the data to other parts of my application (a notifier and a queue), and my other parts of this application consume that data to perform some control operation.  This is actually modified from the "Continuous Measurement Application" template (a very powerful template, btw).

 

shared variable example 2.png

 

Anyway... Notifiers, Queues, Shared Variables... very powerful things to have in your knowledgebase for LabVIEW.  I suggest learning them as they will add more flexibility to your projects.

0 Kudos
Message 3 of 10
(6,052 Views)
Solution
Accepted by topic author Pistolaa

I uh... I made a video about it. I hope that you don't mind. Smiley Embarassed

 

I stumble my words a little bit, you know, refer to outputs as inputs, confuse left from right and laugh unnecessarily. But I think it does the job.

 

Let me know how you get on.


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

Message 4 of 10
(6,042 Views)

To avoid overcomplicating it, I avoided talking about things like synchronous display and programmatically passing a reference to the Main VI's Front Panel, which I think would be a nicer solution.


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

Message 5 of 10
(6,040 Views)

Thank a lot for the video that exactly what I was looking for. The one problem I do still have is when I create the subvi from the Waveform chart the connector only has 2 terminals and when I go change the pattern to include more terminals the subvi in the main vi block diagram becomes shaded out, I've attached an image and the new terminal for the string is not available in the main vi.

 

I'm sure I'm missing something super easy. But again thank you for your help it was really appreciated.

0 Kudos
Message 6 of 10
(5,987 Views)

Glad I could help! Right click on the SubVI Icon in the Main VI and hit Relink to SubVI.


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 7 of 10
(5,984 Views)

Awesome, thank you

0 Kudos
Message 8 of 10
(5,981 Views)

Sadly the video is not available anymore 😞

0 Kudos
Message 9 of 10
(4,522 Views)

Hi Alex Thomas,

 

can you please again upload the YouTube video? It would be a great help for me.

 

Kind regards!

0 Kudos
Message 10 of 10
(3,849 Views)