LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ICan I access data in a subVI as it changes not just at the end?

Hi,
 
I have created a subVI that is a simple counter that has 2 outputs:
1 - A boolean to show that is has finished
2 - The output for the value of the counter.
 
My problem is that I want the value for the counter to be available every time it changes but the subVI only returns the final value.
 
Is it possible to access the data for the output of the counter when is changes (I would like it to drive a case statement on the front panel of the host VI).
 
Thanks.
0 Kudos
Message 1 of 7
(4,852 Views)
On your main VI, create a numeric control.  Create a reference to this control and pass it in to your subVI.  Within the subVI, write to the value property of the referenced control.  Whenever you change the value within the subVI, you will actually be changing the value of the control on your main VI.
Make sure that when you change the value, you do it inside of whatever loop you have within the subVI.
S G
Certified LabVIEW Architect, Certified TestStand Architect, Certified Professional Instructor
0 Kudos
Message 2 of 7
(4,848 Views)
Here's an example subVI that will illustrate what I just explained above.  Create a main VI and pass in a reference to a numeric control to the subVI.  When you run it, you should see your expected behavior.
S G
Certified LabVIEW Architect, Certified TestStand Architect, Certified Professional Instructor
0 Kudos
Message 3 of 7
(4,840 Views)

Thank you.

I tried to do what you said but it didnt work. I think it doesnt work because I am using an FPGA target (PXI-7831R).

I have attached a screen dump showing the subVI, where the subVI is called and the error dialog box.

After looking at your example, I think I've done something similar but I cant use all the tools that you did.

Have I done something wrong or is there another way of doing it on a FPGA?

Thanks for your help.

0 Kudos
Message 4 of 7
(4,836 Views)
The only things I see missing are that
1.  On your main VI, the reference has not been wired into your subVI or to anything.
2.  The subVI seems to have the Counter Output Reference as a constant and not a control.  Instead, from the front panel, create a control>>Refnum>>Control Refnum.  Right-click>>VI Server Reference>>GObject>>Controls>>Numeric.  Add this refnum to the connector pane so that it is an input (preferably make this a required input).
 
This method is similar to passing a pointer into a function in C/C++.
 
 

Message Edited by S G on 07-17-2007 08:10 PM

S G
Certified LabVIEW Architect, Certified TestStand Architect, Certified Professional Instructor
0 Kudos
Message 5 of 7
(4,827 Views)
I cant create a RefNum in that way on the FPGA.
 
In my subVI, I created a number control and then went create-> Reference and what you see on the screen is what it came up with.
 
Maybe this is not possible on the FPGA.
0 Kudos
Message 6 of 7
(4,823 Views)
Unfortunately, I do not have the FPGA module and cannot test if refnums are supported or not.  That could be a quick question for this board " Are refnums supported on the FPGA module?"
S G
Certified LabVIEW Architect, Certified TestStand Architect, Certified Professional Instructor
0 Kudos
Message 7 of 7
(4,820 Views)