LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

passing VISA resource

I'm passing a visa resource name from the main vi to subvi, the problem is that VISA resource is never passed to the subvi because the output of VISA read doesn't display anything (Subvi is working fine by itself). Why is that?
0 Kudos
Message 1 of 10
(4,484 Views)
Would you attached your code here (at least demonstrate how it is done) so that one of us can look into it?

ian
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 2 of 10
(4,479 Views)
All I can say is that you must be doing soemthing wrong because I've never had a problem with passing a VISA name to a subVI. Is the name defined in the main VI correctly? Have you connected the correct output (i.e. dup VISA resource name and not the read buffer)?
0 Kudos
Message 3 of 10
(4,479 Views)
Do you think there might be a problem with the way the connector pane is associated with the controls of the subVI? Try watching your code in highlight execution so that you can better describe where the problem occurs.
0 Kudos
Message 4 of 10
(4,479 Views)
Sorry to pick up an old thread, but I too started having trouble passing a visa resource to a subVI. It was working fine, but upon upgrading my software in a totally different location to the problem, this bug crept in. Was there any explanation as to why this might be happening or how to solve it?

I can say that when I run the subVI it works fine. When I THEN run the main VI it works fine - once - but then when I try to run it agian it doesn't seem to want to pass the visa resource name through again ...

I'm currently using Labview 8.2 if that's any help.



0 Kudos
Message 5 of 10
(4,305 Views)
Would you be willing to post a small sample of the code you see displaying this problem?
 
Chris C
0 Kudos
Message 6 of 10
(4,283 Views)
Chris C,

Here is the sub vi (called "initialise serial") that doesn't pass on the visa-resource name to it's own subvi's (also attached). Do you think trying to re-install labview might fix this problem as has only recently started occuring?

Thanks!

Charles C.
0 Kudos
Message 7 of 10
(4,271 Views)
Hi Charles,

I couldn't find a problem in your vi. The visa resource name is correctly wired and is given to all sub-vis...

But please try to code a better style. Already existing functions of LabVIEW can guide you...
So please use error-in/out and resource name in & -out for your sub-vis. This way you can get rid of those sequences.
When you use sequences try to use flat ones - they are much easier to understand...
Try to avoid overuse of locals. They will easily lead into race conditions!

I made small changes to your vi's, but nothing special 🙂
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(4,258 Views)
Thanks GerdW.

Even with your cleaner formatting it still doesn't want to pass the Visa resource through on our computer. I'm guessing it's a labview bug that's snuck in becasue of somehting locally on our computer. We'll try re-installing Labview and see how we go...

Cheers

Charles C.
0 Kudos
Message 9 of 10
(4,253 Views)
Charles,
 
Looking at your code the only issue that I can see is that you never open a visa resource. What you need to do is use the VISA open VI and connect the Visa Resource output of this to your read and write VI's. Also once you are finished you will need to Close the Visa Resource using the VISA close VI. Please try adding these and let me know if this helps.

Regards
Krista S.
Applications Engineering
National Instruments
0 Kudos
Message 10 of 10
(4,226 Views)