LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

displaying indicator values (indicator is in a while loop and while loop is in a sub vi) on the main vi

Hi,

 I want to see indicator values (indicator is in a while loop and while loop is in a sub vi). I want to see indicator values on main vi. But the problem i am facing is that the indicator value is not updated on the main vi. Although it is updated in the sub vi. Please help me so that the indicator is updated.

0 Kudos
Message 1 of 7
(2,595 Views)

To do what you want to do will require some effort. Remember there are two (and only two) rules governing execution within LV.

 

  1. Any node (VI, structure, function, etc) with all its inputs satisfied will begin executing (this is whi LV is inherently multitasking).
  2. No node will output data until it finishes executing. (This is what is causing your problem)

To accomplish what you want, you will need two things:

 

  1. Some mechanism for the subVI to publish the data it is generating so it is available outside its dataflow. This mechanism could be a functional global, queue, notifier, user event -- there are a lot of options.
  2. You have to write your top-level VI such that some part of it isn't waiting for the subVI to finish and so is available to monitor the communications mechanism that you created in the subVI. This is the point of things such as the producer/consumer structure - so start there.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(2,594 Views)

You can place the indicator on the main VI and wire a reference to it to the subVI. Inside the subVI, you can update the value of the main indicator using a value property node.

 

It would be much easier for us to help if you could attach a simplified version of your code.

Message 3 of 7
(2,591 Views)

What he said...

 


altenbach wrote:

You can place the indicator on the main VI and wire a reference to it to the subVI. Inside the subVI, you can update the value of the main indicator using a value property node.

 

It would be much easier for us to help if you could attach a simplified version of your code.


 

Another way would be to pass a reference to the Main VI's indicator to the Sub VI and update it with a Property Node.  This removes the requirement of the Main VI to wait while the Sub VI is running.  I expect that it adds some overhead that you might not find acceptable

 

reference.png.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 4 of 7
(2,588 Views)

Hi,

 

I have a similar problem as well as a question or two about running subVI's.  Basically, I am trying to create a project that will use both syringe pump injections and the opening and closing of valves to transport a fluid.  As of now, I have a program written for the syringe pump that I was able to modify from an instrument driver from the manufactuer of the syringe.  The goal is to just have the operator press a single run button, as all volume and flow rate conditions will stay the same from trial to trial.  I created two separate syringe pump suvbVI's, one injects 1mL of fluid at 1mL/min and the second injects 2mL of fluid at 1mL/min.  

 

I want to use the flat sequence structure to run these two subVI's sequentially, which I am having some difficulty with.  I set this up so that the operator must press an "OK" button in order for the case structre to read "true" and begin the operations in the flat sequence.  Both subVI's work correctly if operated on their own.  However, when I use the highlight data flow function (lightbulb on block diagram) I can see that pressing the OK button causes the case structure to read true, and the program to engage the first subVI.  Upon opening the block diagram of the first subVI and using the same lightbulb tool, I noticed that the information is getting stuck in the first while loop and repeating itself endlessly.  Any suggestions as to why this may be the case?  (I did go into each subVI and changed the VISA resource name to the correct COM port)

 

Also, once I figure out how to get the information to flow correctly, I do want my main VI front panel to display some of the front panel indicators on the syringe pump VI's, such as the volume dispense and tank.  I would like to know more information about how to reference a wire to the subVI as previously mentioned in this thread.

 

Sorry this was such a long post!  I attached the main VI with the embedded syringe pump subVI's that I was talking about.  Any suggestions would be greatly appreciated!

Thanks

0 Kudos
Message 5 of 7
(2,551 Views)
  1. You might be better served if you created a new thread for your question
  2. You didn't include your VI's sub-VIs, so we can't see what's happening

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 6 of 7
(2,549 Views)

Thanks for your reply.  I created a new post like you recommended under the labview board.  Also, here are the two subVI's as well as the main VI posted again (I posted these links on the new board I created as well)

 

Thanks

0 Kudos
Message 7 of 7
(2,544 Views)