Showing results for 
Search instead for 
Did you mean: 

Code converted to Sub-vi doesn't function

Go to solution

Please see the attached snippet(s).

This code works fine in the loop as show.  However, if I convert it to a sub-vi (with controls and indicators exterior to the sub as usual), the code doesn't work.  I am initializing as in the attached expansion.

Can't seem to figure out why?




Thanks all,


0 Kudos
Message 1 of 13

Stop gets read when you call the subVI and never again.  You have the opposite problem you think you have.  It does function... forever.

Message 2 of 13

Hi bonnerup,


call those two case structure sequential instead of parallel. They use a shared resource!


You should also replace those "x/=y" functions by BooleanCrossing for boolean signals (or just an XOR)…

Using AutoCleanup would be nice, too.


Edit: Are talking about the "code in the loop" or "whole code as shown in the snippet"?

Best regards,

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 13


Edit: Are talking about the "code in the loop" or "whole code as shown in the snippet"?

What I was trying to refer to was the code in the sub, when placed as a sub-vi in a while loop, doesn't work.  The expanded code shown in the while loop does perform as expected.


Yea, know it's nasty, but it IS a construction zone at the moment.


0 Kudos
Message 4 of 13

Please show us the diagram of the created subVI and the diagram of the caller. Even better, attach your VIs (before & after, all zipped up)

0 Kudos
Message 5 of 13

Thanks for helping.

Attached are two vi's and the lvlib of the Agilent subs.

Same code in both except one is reduced to a sub - it does not work; other does.

The parallelism is due to asynchronous calls to each channel.

Really appreciate your help.  Sure I'm doing something obvious, but just can't see it %>(




0 Kudos
Message 6 of 13

You did not attach the created subVI.

0 Kudos
Message 7 of 13
0 Kudos
Message 8 of 13

Thanks. Your lvlib is also just an empty shell, there is no code (drivers) in it at all. Is there  web site with the help?


Have you tried running the two case structures in sequence instead of branching the wire as has been suggested?

0 Kudos
Message 9 of 13

Attached are the Agilent E363x drivers directly from the NI website of third-party drivers.  I hope this helps.


0 Kudos
Message 10 of 13