From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Global variable: continuous change

Solved!
Go to solution

Hi,


I have some trouble with a VI program. I am trying to create a program where a variable X start with a initial value during some ms. Then this variable must be used in another while loop, and the value should be changing continuously after some calculations. I use it just for the first calculation, and then it changes continuously for other calculations.
Maybe a global variable must be used, but I'm not sure.

 

I have found this tutorial, is it useful for this problem?
http://www.ni.com/white-paper/7585/en/

 

Thank you.

0 Kudos
Message 1 of 15
(3,638 Views)

Hi demark,

 

LabVIEW doesn't use "variables" in the same manner like text-based languages.

 

You might use a local variable, but notifiers might be the better solution…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 15
(3,621 Views)

Thank you Gerd,

 

Would you mind to help me with any example please? I am blocked with this problem...

0 Kudos
Message 3 of 15
(3,614 Views)

Hi demark,

 

a very simple example using a local variable and a sequence structure:

check.png

 

Note: sequence structures and local variables aren't recommended for "professional" LabVIEW code…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 15
(3,611 Views)

Let me know if I understand the sequence of the example:

 

1- Initialize the variable for value=1
2- Then stop while 1234 ms
3-. Value = 2
4-. "While" loop for 10ms whith the last value

 

Isn't it like this? Excuse me about this simple request, but I haven´t used this before.

0 Kudos
Message 5 of 15
(3,603 Views)

Hi demark,

 

did you run such a small example VI on your computer? Would be easiest to watch that VI executing…

 

1-3 are ok. Point 4: While loop runs in parallel, reading the "value" each 10ms…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 15
(3,590 Views)
The first thing to do is to try as hard as you can to utterly forget anything you learned about programming in another language. Even in places where the same words are used they typically mean verrry different things.

As was pointed out to you, LabVIEW doesn't have named variables, LabVIEW has wires.

As I understand it you have a value that you will use iteratively in a calculation. The way to do that is in a loop with a shift register to pass the changing value between iterations.

You should check out the online tutorials. They will help you a lot.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
Message 7 of 15
(3,554 Views)

Thank you, I will try it. 

 

0 Kudos
Message 8 of 15
(3,542 Views)

Hi again,

 

I need some more help, continuing whith the last example.
As you can see in the image attached, the local variable in the red circle changed in the sequence from indicator to an useful variable in the while loop.

My problem is that I make a copy of the local variable, but it appears like indicator and can't be send to an other process.
Can anyone tell me what must I do to change it?

0 Kudos
Message 9 of 15
(3,391 Views)

Forget the last post, I found it 😉

0 Kudos
Message 10 of 15
(3,376 Views)