LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update an indicator from within while loop with event driven programs

Solved!
Go to solution

I need to continuously evaluate code to (re)populate the graph, I want to have access to that same graph in different event cases. Each event case has its own code that needs to itself be continuosly evaluated. So I believe I do need the event structure, or a structure of some kind to change what is being graphed in the different cases, is there another way? I think it is a very simple piece of software in principle, am I explaining it poorly still?

0 Kudos
Message 11 of 19
(2,124 Views)

So do you want to append new data to the existing graph or only show the latest data?

And yes, as I suspected, you are still locking the front panel in the OK case, so unless the "stop 1" is originally true, you will never be able to exit that inner loop.

 

You are also trying to graph 10 identical points in each case, and since you only show lines on the graph, you'll never see anything useful.

 

 

0 Kudos
Message 12 of 19
(2,122 Views)

Event structures follow dataflow, just like everything else. My favorite way to have an up to date indicator and an event structure is using a shift register:

 

 

Putting the indicator before the event structure in the dataflow will make sure it's always up to date.

0 Kudos
Message 13 of 19
(2,119 Views)

@altenbach wrote:

So do you want to append new data to the existing graph or only show the latest data?

And yes, as I suspected, you are still locking the front panel in the OK case, so unless the "stop 1" is originally true, you will never be able to exit that inner loop.

 

You are also trying to graph 10 identical points in each case, and since you only show lines on the graph, you'll never see anything useful.

 

 


 

Either appending or showing the new data is fine, on my application only showing the new data is required. 

 

I tried to make a vi that was similar in principle to the more complex one I am working on, and goofed on the OK button. The graph output was just a toy example, it definitely could have been nicer.

0 Kudos
Message 14 of 19
(2,116 Views)

@ijustlovemath

 

So in my case the "Set some number" needs to come from other code that is called as fast as possible, like within an inner while loop. Will this still work to update the indicator?

 

e.g. set some number is coming from a homemade vi function generator

0 Kudos
Message 15 of 19
(2,113 Views)
Solution
Accepted by topic author sholtz

No need for an extra while loop! Just put it in the timeout case, convert it to a graph, and put that graph cluster in a shift register. Then put an indicator for the graph after the left side shift register and make sure to wire something to the event structure to make certain that the indicator gets updated before the event structure (as seen by the unused orange tunnel in the event structure).

 

Every time you timeout, in your case every 10ms, the code in the timeout case will run.

0 Kudos
Message 16 of 19
(2,110 Views)

I think I understand, this sounds like exactly what I want to happen. Thanks so much!

0 Kudos
Message 17 of 19
(2,105 Views)

As I said, you don't need an event structure at all. Don't complicate things!

 

How fast is "as fast as possible"? What is the time limiting step? Where does the data come from and in what form?

0 Kudos
Message 18 of 19
(2,096 Views)

The data is a matrix/frame (or 2-d array in labview language?) of 16-bit uints coming off of a high speed microscopy camera, >1Gb/s. It will be written to disk, or to memory depending on how I set it up. I believe the time limiting step will be taking a branch of what is going to the display graph (that was the subject of this thread) and writing to disk.

 

All of the guides/support is set up for Labview, as may be obvious none of the provided example programs have the right combination of functions to let me get away with not understanding labview.

0 Kudos
Message 19 of 19
(2,094 Views)