08-13-2020 11:39 AM
Hi,
I'm trying to understand how a subVI works in this case:
I create a subVI, like in the picture below. Where the "Numeric" control replace 1st value in the "Array" control, and move the result to "Array 2" indicator.
Then I create a VI, attach the subVI above:
What I want is, every 2 seconds, the array's 1st value is replaced by a number that I enter (numeric).
The problem is, while running this VI, only the second block works.
Is there any way that I can make 2 blocks work at the same time?
The .vi files are attached below.
Solved! Go to Solution.
08-13-2020 12:13 PM - edited 08-13-2020 12:32 PM
Your VI is not reentrant, meaning that the "first call?" only executes once globally. Whatever instance executes first gets it. The other doesn't.
Possible solutions:
In general, you might also want to initialize your shift registers. In fact you could make the subVI reentrant and have a feedback node inside the subVI, dramatically cleaning up your main diagram.
08-13-2020 12:33 PM
@altenbach wrote:
In fact you could make the subVI reentrant and have a feedback node inside the subVI, dramatically cleaning up your main diagram.
Here's how that could look like:
08-13-2020 12:47 PM
@altenbach wrote:
@altenbach wrote:
In fact you could make the subVI reentrant and have a feedback node inside the subVI, dramatically cleaning up your main diagram.
Here's how that could look like:
Or just use the Data Queue PtByPt.vi. No development required.
08-13-2020 01:11 PM - edited 08-13-2020 01:22 PM
@crossrulz wrote:
Or just use the Data Queue PtByPt.vi. No development required.
Yes, I intentional did not mention that in order to keep it simple. 😉 (I actually looked up the help on the ptbypt queue before posting).
(Also note that it is NOT the same because it fills the queue from the "other side")
Substituting basically a "one liner" subVI with something hidden deep in the palettes and having much more functionality (9 terminals!!) Would just complicate things to any newbie.
It's more about learning and understanding the basics of subVIs, "first call?", reentrancy, feedback nodes, etc. than to find a turnkey solution for exactly one specific problem. Maybe I misunderstood the purpose. :).
Data queue is strictly for DBLs (or CDBs for the other version) and this will not work, or work well, for most datatypes (integers, strings, etc.). Maybe somebody will make a VIM out of it eventually ...;)
08-13-2020 01:26 PM
That works. Thank you so much!!