12-04-2018 06:09 AM - edited 12-04-2018 06:15 AM
Hi, 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
12-04-2018 06:22 AM
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.
12-04-2018 07:36 AM
please pardon my ignorance, im not quite familiar with labView. How can i make them run in parallel?
12-04-2018 09:48 AM
Take some of the free online tutorials and the answer will quickly become clear.
12-04-2018 12:40 PM - edited 12-04-2018 12:47 PM
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)