From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -1073807346 occurred at VISA

My progarm has a very simple Visa write to a E4432 Signal Generator, which worked very good. After sometime Suddenly an error occurs which I cannot understand :" Error -1073807346 occurred at VISA Write in Setting Generator.vi;Possible reason(s):VISA: (Hex 0xBFFF000E) The given session or object reference is invalid."

But when I am using the NI-488.2 Communicator with the same SCPI syntax, it works right away. I chose the right Instrument handler address from the pull up menu of the controller.

What is wrong?

Regards

Yariv
0 Kudos
Message 1 of 12
(3,572 Views)
Hi Yariv,

Just to clarify the question, are you saying that this program/instrument combination worked for some time, and then it suddenly stopped working from some point on? Or do you mean that the program runs fine for some time, and then this error occurs? I am thinking you meant the first option, but I wanted to make sure.

If that is indeed the case, you need to see if anything has changed from the time that it has worked... driver versions, differences in the program, different cables, anything. Also, the instrument could have become damaged, or the cables could have been knocked loose. If the program hasn't changed, there is not any reason that it would just stop working. Given the error that you obtained, it is much more likely that something has changed with the configuration. A good way to test this would be to try communicating with the device through Measurement and Automation Explorer (MAX) using that same VISA Resource Name.

Keep us posted on how this develops!

john
Applications Engineer
0 Kudos
Message 2 of 12
(3,561 Views)
Hi John,
Thanks for the fast response.
The problem I nhave and probably others have too, is with the VISA OPEN/CLOSE sessions. Since I haven't use them in my program, rather write right away on the Instrument Handler to the specific instrument.

When I first time run my program it takes proper control of the devices, if I break the running application in the middle I cannot run it again.
All the other issues worked fine as like seeing the instruments on the MAX and even writing directly to them.
Regards
Yariv
0 Kudos
Message 3 of 12
(3,553 Views)
You don't have to use VISA open, but you do have to use VISA close. If you don't, as you saw, the communication won't work until you restart LV. The solution - don't stop VIs in the middle. It's bad practice. Stop them in a proper fashion, while closing all references, and you won't have a problem.

___________________
Try to take over the world!
Message 4 of 12
(3,551 Views)
Thanks,
But what if my DUT suddenly break the link, and another VI in this case stops the connection to one instrument (it RESETS it) but the other instrument does not know about it, do I have to take care of him too (=VISA Close)?

I used a single New VI with a VISA CLOSE and tried doing it manually before starting a new run, but it did not succeed. Meaning that it even errored at the beginning of OPEN VISA session.

It this because I am using two instruments? Are there any hints that I can get.

Regards
Yariv
0 Kudos
Message 5 of 12
(3,547 Views)
Hi again yariv,

tst is exactly right... it is very important to close all the VISA sessions that are opened before your program exits or else you will run into problems the next time around. The number of instruments you are using does not matter as long as this general rule is followed. You may need to get a little more creative with your programming in order to make it work, but it is definitely doable. I am unsure how exactly you have your two devices set up, but you could perhaps write some code so that if the DUT fails, an error could occur that you could then 'catch' and do whatever programming you need, such as closing out your VISA sessions.

And just to reiterate tst's post again, it is much better practice to stop a program using a programmatic stop button rather than using the Abort button on the toolbar. That button is there for emergencies or if you get stuck in a program that you cannot stop any other way, but it stops the code immediately, so that none of the open resources or files are closed.

Good luck with your programming!

john m
Applications Engineer
0 Kudos
Message 6 of 12
(3,524 Views)
Hi John,
I came quite along with the option you provided me but now it hits me again, though I haven't done vast changes.
My program (attached) uses 2 simple state machine. I have managed to use, in case of Errors I cannot handle, a proper quit of the program, meaning I point in such a case to the State called "Quit". I did this in order to have only one EXIT of the program and not severals.

Still the first time it runs but the second time as soon as it runs to the first VI it shows the VISA ERROR.

Where can I optimize my program?
Regards
Yariv3G
0 Kudos
Message 7 of 12
(3,491 Views)
Hi John,
I came quite along with the option you provided me but now it hits me again, though I haven't done vast changes.
My program (attached) uses 2 simple state machine. I have managed to use, in case of Errors I cannot handle, a proper quit of the program, meaning I point in such a case to the State called "Quit". I did this in order to have only one EXIT of the program and not severals.

Still the first time it runs but the second time as soon as it runs to the first VI it shows the VISA ERROR.

Where can I optimize my program?
Regards
Yariv3G
0 Kudos
Message 8 of 12
(3,490 Views)
Regarding the message above I've added a SPY file to the same program, if you could spot my problem faster.
Thanks Again
0 Kudos
Message 9 of 12
(3,488 Views)
Hi Yariv,

I didn't dig through every part of your code, but for the most part, it looks good. You've got it set up to run the "Quit" case last, which closes out your two VISA sessions before exiting. However, I did notice that on the "Sensitivity check" case, there is a possibility that the Front subVI will pass out a True, which would then stop the while loop immediately without going through the Quit case. If this happens, and something has happened in the SensitivityBlock 1.vi to interrupt the VISA Resource Name wires (and I did notice that these wires were not passed through in all of the cases in this subVI), then the state machine will exit immediately without passing the proper VISA Resource Name values out to the VISA Close VIs.

I also see in your post that you said that this error came back after some changes. When this happens, I would always look very closely at the parts of the program that I modified in order to see what I have changed in order to cause the error. You could also go back to a previously saved version of the program and add the changes one by one, making sure that the program still works at each step.

I won't be able to go through your code extensively, but I recommend tracing through the VISA Resource Name wires and making sure that in every possible scenario, these values get passed through to the close VIs. Good luck with your application!

john
0 Kudos
Message 10 of 12
(3,477 Views)