LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Global variable: continuous change

Solved!
Go to solution

@demarkIV wrote:

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.


You already got some good advice from Mike, but maybe you should re-think some of the other points too.

 

  1. There is no "continuously". All value changes are quantized to the local loop time.
  2. Your producer and consumer loops are not synchronous. What are their relative rates? Watch out for race conditions!
  3. How long are the "calculations" and how do you know when "after" is?
  4. Why can't you use a single loop and just switch code according to the elapsed time? No local variables needed.
0 Kudos
Message 11 of 15
(1,389 Views)

Hi Altenbach,

 

Well first of all thank you very much.

I´ve made lot of changes since the first time, and the program is doing more or less most of the things I need. I am just making small changes to correct anomalies.

As you can see in the image, the numeric indicator doesnt give me the same value that I need from the x/y indicator.

¿Why is it? Would you mind to tell me please?

 

Thanx

 

0 Kudos
Message 12 of 15
(1,358 Views)

The numeric indicator only gets updated onafter the loop ends.  The X/Y indicator gets updated continually inside the loop.

 

Now that loop will run only one time, or will run forever depending on the value of the boolean wire that gets passed into the loop.  If it is True, it runs for ever and the only way to end the VI is to abort it.  If it is False, then the loop only runs one time.

 

Try doing a block diagram cleanup.  You have a lot of backwards running wires making it hard to read.  What is the purpose of adding zero to a number?

 

There seems to be a lot of basic things you still need to learn about LabVIEW.  I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 13 of 15
(1,350 Views)

Duplicated post.

0 Kudos
Message 14 of 15
(1,350 Views)
Solution
Accepted by topic author demarkIV

Please don't attach truncated pictures with wires going in all directions, attach the actual VI instead.

 

As has been said, you still need to understand dataflow. Run your Vi in execution highlighting mode to see why it makes no sense.

0 Kudos
Message 15 of 15
(1,319 Views)