LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can a VI read a value changed in sub-vi consisting of timed loop in real time

outter loopoutter loopsub VIsub VIHi, im working on a project where i have a list of arrays that define a current value. I have a sub-vi that reads the the values of the array and increments the index every 100ms and writes it in a global variable. the main VI only reads the value of the global variable. The problem is only the last value is read because the Sub-VI never exists the timed loop so the main VI never reads the global variable until the timed loop stop condition is met. I need a solution that makes the main VI able to update the global variable value each time the value changes inside the sub_vi. 

Thanks in advance

Download All
0 Kudos
Message 1 of 5
(1,984 Views)

Due to data flow, your VI will not work.  A loop cannot iterate until everything in it has completed.  Since your subVI has not completed, your main loop cannot iterate and therefore you will not get updates through the global variable (can only be read once per iteration).  The simple solution is to have the subVI and the main loop run in parallel.


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 5
(1,974 Views)

please pardon my ignorance, im not quite familiar with labView. How can i make them run in parallel?

0 Kudos
Message 3 of 5
(1,956 Views)

Take some of the free online tutorials and the answer will quickly become clear.

LabVIEW Basics


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 4 of 5
(1,936 Views)

I don't understand the purpose of indexing into an empty array, but you could wire a control reference to a subVI connector and use a value property node to update it.

 

Still, you probably want to run the subvi asynchronously...

 

Also, terms like "real time" need to be defined. An update every 100ms probably does not need a timed loop. Is this running on an RT system?

 

(Posting by phone, cannot try your code)

0 Kudos
Message 5 of 5
(1,926 Views)