LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is my parameter not getting sent correctly to this subVI?

Solved!
Go to solution

Hello, I have a couple sub VI's and I'm running into a problem. I usually pass the VISA resource name to the sub VI so that it can do stuff with it. I've done this in the past with no problem.

 

Now, when I do it I'm getting error:

visa5.PNG

 

Here's where the VISA address is passed to SMU_SetSourceLevel in the block diagram for OR_IVsweep_withLIA:

 

visa1.PNG

 

If you double click that VISA resource name so it shows on the front panel of OR_IVsweep_withLIA, you can see that it's the correct one:

visa2.PNG

 

But, if I double click on the SMU_SetSourceLevel icon so it opens it, you can see that it's clearly not getting passed:

visa6.PNG

 

(despite the fact that it shouldn't matter here, the default value is also the correct address.)

 

If I manually enter it, or do right click->data operations->reinitialize to default value, it appears, and then if I click run, it executes perfectly:

 

visa7.PNG

 

What could be happening here? I can include more code if need be, but the main VI is pretty huge. Either way, this shouldn't be happening...

 

0 Kudos
Message 1 of 7
(3,100 Views)

Hi opto,

 

I think the problem is within your VIs.

Mind to attach them (or smaller example VIs with exactly the same problem)?

 

(When your car needs assistance you also bring the car to the repairshop and not just some images of your car…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(3,093 Views)

My first suggestion is to make sure the VISA Resource input is REQUIRED.  My gut feel is that you do not have it wired, therefore not being passed.  Setting the input to required will cause you being unable to even run your VI unless that input is wired up.

 

Otherwise, try reducing the code to a small example that is showing the problem and then post it.  Then we can offer better advice.  And in doing this process, you will likely find the problem anyways.


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 3 of 7
(3,090 Views)
Solution
Accepted by crossrulz

Shaking my magic 8-ball..... The resource wire passes through a for loop on a tunnel rather than a shift register and the loop executes 0 times.  Since the loop does not execute the default value is sent out of the tunnel.  The default for a VISA IO session in an invalid session.  

 

Not bad for a guess.  Show code and use SRs on for loops


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 7
(3,037 Views)

Hi, I've attached more info. The mystery thickens.

 

First, here's a simpler test case where I try isolating the problem. I do nothing but call SMU_SetSourceLevel from an otherwise empty VI, with the same VISA address:

 

visa1.PNG

 

And this works fine. It does what it's supposed to with the machine, so it seems clear that the VISA resource can be passed to SMU_SetSourceLevel. That also tells me that the problem is probably in my original VI (OR_IVsweep_withLIA) that calls SMU_SetSourceLevel.

 

It's a little tricky because OR_IVsweep_withLIA has a few other IV's that are irrelevant and I'd have to attach them all. However I copied all and pasted it in a new test VI and pared it down to what I'm pretty sure is the problem.

 

Here is a very simplified version that still has the error:

 

visa2.PNG

If you notice, path given by the error dialog tells us that it's from SMU_SetSourceLevel, which I always assumed was the first one there, inside the case structure and for loop. However, I think it's actually the ending one because if I remove it, the VI runs without error:

 

visa3.PNG

 

The tunnel mode is set to "last value" which I think should work fine, since each one should still be the same value as the first...

 

Okay, I believe the issue is now too confused. The above was truly happening, so I started putting a lot of VISA resource name indicators all over the place to see where it was failing to pass to the next VI, and apparently at some point my machine decided to disconnect, which took me a few minutes to figure out.

 

After reconnecting it, even the original VI works, sooo... I'm going to mark this as solved for now, I'm sorry for the time wasting and thank you.

0 Kudos
Message 5 of 7
(2,986 Views)

Hi opto,

 

generic comments on your BD images:

- Put ALL controls/indicators outside of loops. There is only one reason to have them inside loops: their value changes while the loop is executed. This especially holds true for controls/indicators associated in the connector pane!

- "important" values (like file/VISA/whatever references) should be kept in shift registers when the wire crosses a loop…

- using the autocleanup button is recommended…

- remove coercion dots is recommended too…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(2,978 Views)

Magic 8-Ball calibration confirmed!  At some point one of your loops iterates 0 times resulting in an invalid VISA Resource on the output tunnel. Replace the tunnel with a Shift Register!


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 7
(2,971 Views)