LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get data from a subvi which front panel is opened inside a sub panel

Good morning

 

I am working a modularized software and need to show the Front Panel of a subvi in the main.vi while getting data from the same subvi.

 

My initial idea was to use the connector pane of the subvi together with the "Insert VI" Invoke Node (see image below)MTH.png

 

 

But LabVIEW show me a error 1000 message: "LabVIEW: The VI is not in a state compatible with this operation."

I think it's because of trying to load two instances of the same VI in the memory

 

Do you have a idea of how do I display the Front Panel of the subvi in the main.vi and get data from it

at the same time?
 
The VIs are attached in the post.
Download All
0 Kudos
Message 1 of 8
(3,067 Views)

Hi mthheitor,

 

you cannot run a VI already prepared for execution (due to using it as a regular subVI)…

 

What about queues, notifiers, etc.?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(3,060 Views)

Well, yes. The main options would include Queues, Events, Action Engines, DVR and Globals.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 8
(3,039 Views)

My recommendation is to use the Asynchronous Call By Reference to run your subVI and use the same reference to insert into your subVI into the subpanel.  Then use User Events to send data to your main GUI (get the events via the Event Structure).


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
Message 4 of 8
(3,030 Views)

@crossrulz

 

I'm trying to use the the User Events to send data to my main VI, but facing two difficulties:

(please see the sample code attached)

 

1) How do I get the "event registration refnumber" from the Reg Events inside subvi.vi ? (the refnum to put in the Event Structure on main.vi)

 

2) When I click on the Stop button on main.vi and try to run again, I get the error message: "Error 1000 occurred at Invoke Node". But when I click on the Stop Button of subvi.vi and only then on the Stop Button of main.vi, so running main.vi again doesn't cause any error. I think this is because the subvi still have opened references inside memory... Am I doing something wrong with "Close Reference"?

 

Print 10.PNGPrint 11.PNG

Download All
0 Kudos
Message 5 of 8
(2,951 Views)

Here are a couple of options:

1. Use an Action Engine to maintain your User Event reference.

2. Use the Asynchronous Call By Reference (like I told you to before) and then you can pass the Event reference into the VI.


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
Message 6 of 8
(2,940 Views)

Does this Asynchronous Call By Reference is ok?

 

Print12.PNGPrint13.PNG

0 Kudos
Message 7 of 8
(2,923 Views)

You need a Register event in each VI, or they'll consume the same event and you'll get some strange effects. On the plus side you'll only need 1 input to the sub-vi. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 8 of 8
(2,792 Views)