LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting value out of loop

Hi

 

I'm new to LabView. I want to create a SubVi that is basically running a while loop and a value is changing during the loop execution. I need to be able to take the change value out of the loop during execution and make it one of the connections in my SubVi.

 

1. Is this a good approach to have a SubVi that has an output of a changing value?

2. If yes, I read in some forums about global variables as a solution but when I tried it I saw that the global variable is working fine, but the indicator I placed on my VI didn't. Is this the only option to get the value?

 

Thanks

0 Kudos
Message 1 of 6
(3,340 Views)

A subVI will not output anything until it is done running.  So if it is continuously running a while loop, it will never exit and therefore nothing will come out of your subVI.  Consequently, anything wired to the output of the subVI will not be able to run either.

 

Can you give some more details about what you are trying to do?  There are many solutions, but which one would be better would depend on your application.


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
0 Kudos
Message 2 of 6
(3,335 Views)

I was trying to create a blinking LED (I know I can use the property to do blinking) as a concept for testing the ability to take a value out of a while loop.

You can see in the attachment what I did. Two of the three LEDs are blinking (one which is a local LED, the second is a global variable which is in write mode within the loop, and the last one is in read mode outside of the loop).

 

 

 

0 Kudos
Message 3 of 6
(3,325 Views)

In your code 'Blinker - global out of while loop' will execute just once. You can put this code in another loop.

And then you will its also blinking..!!


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 4 of 6
(3,315 Views)

I am fairly new to LABView. With my vi I want to be able to change the frequency while the vi is running ,but how do I do that without stopping it and running it again? I would also like to add an LED that corresponds to the frequency. How would I do this. It seemed easy enough but I couldn;t get it to work. 

 

Thank You

Download All
0 Kudos
Message 5 of 6
(3,294 Views)

@Jerome1288 wrote:

I am fairly new to LABView. With my vi I want to be able to change the frequency while the vi is running ,but how do I do that without stopping it and running it again? I would also like to add an LED that corresponds to the frequency. How would I do this. It seemed easy enough but I couldn;t get it to work. 

 

Thank You


This is totally unrelated to this thread.  You should start a new thread.


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
0 Kudos
Message 6 of 6
(3,291 Views)