11-30-2016 02:53 PM - edited 11-30-2016 02:55 PM
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:
Here's where the VISA address is passed to SMU_SetSourceLevel in the block diagram for OR_IVsweep_withLIA:
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:
But, if I double click on the SMU_SetSourceLevel icon so it opens it, you can see that it's clearly not getting passed:
(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:
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...
Solved! Go to Solution.
11-30-2016 02:58 PM - edited 11-30-2016 02:59 PM
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…)
11-30-2016 03:01 PM
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.
11-30-2016 10:06 PM
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
12-01-2016 11:13 AM
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:
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:
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:
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.
12-01-2016 11:50 AM - edited 12-01-2016 11:51 AM
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…
12-01-2016 12:11 PM
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!