LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read the values of front panel variables in loops without using local variables or value property nodes?

Solved!
Go to solution

I know that local variables and value property nodes cause lots of problems.

 

But if I read the value of a front panel variables from outside a loop,

the value is only read once before the loop starts.

During loop iterations, the changed values of the front panel variable is invisible.

 

How can I solve this problem?

0 Kudos
Message 1 of 38
(4,432 Views)

You use the terminal of the front panel control and put that inside the loop.

 

That's probably not the answer you are looking for.  You'll need to post your VI so we can see what you are trying to do and give you ideas on how to do it.

Message 2 of 38
(4,425 Views)

 

While a front panel variable is inside a loop, it's not available to other loops.

 

I want to access the value of the variable in many loops.

 

And I want to write to a front panel variable in many loops, too.

0 Kudos
Message 3 of 38
(4,421 Views)

I guess you could use a queue or a notifier (depending on your circumstances).

0 Kudos
Message 4 of 38
(4,415 Views)

That example you have doesn't show enough information as to what you want to do in each loop, or why they run infinitely.  Do you need to read the control in every loop?  Assuming you do, using a local variable of the control would not cause a problem.

 

Local variables are abused when you are trying to read and write to them at the same time in different parts of your program, especially multiple writes, without any control on the order of execution.

0 Kudos
Message 5 of 38
(4,408 Views)

@Ravens Fan wrote:

That example you have doesn't show enough information as to what you want to do in each loop, or why they run infinitely.  Do you need to read the control in every loop?  Assuming you do, using a local variable of the control would not cause a problem.

 

Local variables are abused when you are trying to read and write to them at the same time in different parts of your program, especially multiple writes, without any control on the order of execution.


How about

?

0 Kudos
Message 6 of 38
(4,392 Views)

@Hornless.Rhino wrote:

I guess you could use a queue or a notifier (depending on your circumstances).


How do you propose I use them?

0 Kudos
Message 7 of 38
(4,390 Views)

@iCat wrote:

@Ravens Fan wrote:

That example you have doesn't show enough information as to what you want to do in each loop, or why they run infinitely.  Do you need to read the control in every loop?  Assuming you do, using a local variable of the control would not cause a problem.

 

Local variables are abused when you are trying to read and write to them at the same time in different parts of your program, especially multiple writes, without any control on the order of execution.


How about

?


You should be more specific when you want to solve any problem. Please do not post very simple question to which the others cannot understand whats in your mind and what you want to achieve. Please explain as much as possible so that you will not be questioned.

 

Good luck.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 38
(4,388 Views)

send it like this to multiple loops...."DATA/value IS DIRECT WIRE" to your input

ProducerConsumerEvents 1_BD.png

0 Kudos
Message 9 of 38
(4,380 Views)

Hi apok,

 

do you think it's a good example to dequeue a queue in 2 independent loops?

This will just force questions on race conditions...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 38
(4,352 Views)