Signal Generators

Showing results for 
Search instead for 
Did you mean: 

Connecting ruby application to HMC 8042 Power Supply Unit using VISA library.

Hi guys.


First of all, sorry if this isn't the correct topic for this question, but i couldn't find any other whose subject got a better match for my problem.


What I'm trying to do is creating a ruby application that can communicate with the HMC 8042. Altough it already works perfectly for it's primary use, something strange turns out to happen in a specific ocasion: once I run the application it can send querys and commands to the psu as I wish, however if by using it I try to repetedly disconnect and connect to the device, it crashes exactly on the third connection tentative. The strange part is that the error message that I'm getting on that is "VI_ERROR_INV_OBJECT", which as I already read on other foruns, happens when more than one application is trying to open a session to the device. However, only my application is running and trying to connect to the psu in my local network.


Do you have any advice for this situation? Because I'm really out of resources to fix this problem.


Thanks for the attention.

0 Kudos
Message 1 of 2

Hey Bruno,


Thanks for using NI Forums to ask your questions. As for the correct forum subject, I would say that your problema is more related to the Instrument Control Forum, since you guys are trying to use NI-VISA to control a non-NI device.


One question I have: Is this post related to this another one?


Regarding your specific question you had, it is hard for us here to give any hint since we do not know how this library works (from what I could learn, it is a set of ruby wrapers around NI-VISA shared library functions). Considering that, I can't tell how they are handling the VISA sessions. In LabVIEW, for example, this problem may occur when you do not close the VISA Session calling the Visa Close function and then trying to run the VI once again. For LabVIEW, this problem is addressed by the following KB article


Error -1073807346: The Given Session or Object Reference Is Invalid in NI VISA


Go ahead and review the article above to see whether you can take something out of it. In addition to that, I encourage you to contact the developer of this library. Apparently, you can contact him using this profile page. In case it is a bug, for instance, it you would be contributing for the project and helping it to become even better.


I hope that helps!



Felipe Flores
Application Engineer
National Instruments Brazil

0 Kudos
Message 2 of 2