LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get numerical indicator outside loop and sub.vi

I have a vi which I want to output a counter value to the panel.  I can get the output to the panel but not when I use it as a sub vi, the value only gets written after the sub vi is done executing.  How can I get the numerical indicator to display constant while the sub vi is running.  I think global variables and/or property nodes may work but I have no idea how to set one up evan after looking at examples.
0 Kudos
Message 1 of 8
(5,375 Views)
Use a control reference. You can pass in a reference to the indicator to the subVI, and the subVI can write the value. See attached example. You can read more about control references in the LabVIEW Help. There are also shipping examples (Help -> Find Examples).
Download All
0 Kudos
Message 2 of 8
(5,365 Views)
In addition, your code has some other problems:
  • Place the "sweep complete" indicator in the inner loop, eliminating the local.
  • The outer FOR loop has no purpose, delete it.
  • The inner loop needs a small wait. You don't need to check for completion evey nanosecond and consume all CPU doing so.
  • ...
0 Kudos
Message 3 of 8
(5,349 Views)
Ok I am still confused.  I have added the node I think correctly.  But I guess I am doing something wrong because the sub.vi cause wiring errors.  I think the local variable was done because of the same thing that I wanted sweep complete it light outside of loop.
Download All
0 Kudos
Message 4 of 8
(5,340 Views)
Hi drew,

you only have to wire a reference to the indicator in the main vi!

Some more notes:
- Instead of running a FOR loop 0 or 1 time you should really use a case structureSmiley Wink
- Use some left-to-right wiring, helps reading your vi a lot!
- Use error clusters to avoid all those stacked sequences!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Download All
0 Kudos
Message 5 of 8
(5,335 Views)
Ok so I checked the vi you gave.  It still does the same things.  THe indicator in the main program doesn't show the angle til the sub.vi is finished completly.  So it jumps from -75 to -71.  It doesn't count down as the anlge changes.
0 Kudos
Message 6 of 8
(5,325 Views)
Hi drew,

you have to wire a reference to the indicator in the main vi!!!
Your subvi has a reference input, but nothing is wired here - so how should the subvi know which reference to take? By pure guessing?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(5,323 Views)
I thought my example was fairly straightforward? Smiley Surprised





Message Edited by smercurio_fc on 07-01-2008 04:38 PM
0 Kudos
Message 8 of 8
(5,305 Views)