LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -1073807246 occurred at VISA Open in Enable_Disable_9012Tx.vi->Deactivation Test with Laser and Pedestal.vi

I been reading the forum to find a solution to this error, but getting no where.

 

This code will run fine for 500 iterations, and then all the sudden this message pops up.

 

Any fix or suggestion to this?

 

FaIlingDawn_0-1758219310268.png

 

Download All
0 Kudos
Message 1 of 6
(166 Views)

Error -1073807246: The Resource Is Valid, but VISA Cannot Currently Access It

 

By any chance, did you try to open another terminal/test panel/software to access the same port while the program is running?

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 6
(130 Views)

No, only LabVIEW was accessing this port.

0 Kudos
Message 3 of 6
(66 Views)

You're using 2023, so I can't open it to look at what's going on specifically.

 

However, the error says it happens at VISA open, but you also say it will run for a while before this happens.

 

This means you're opening VISA and closing it each loop.  You can do this, but it's a waste.  Change to opening it once, then preserving the reference, then close it only when done looping.  Like so:

Kyle97330_0-1758565333135.png

 

Also, just in general, apart from other programs using the device I have seen this error happen most often on cheap 3rd-party devices such as Prolific USB-to-Serial adapters.  If you're using something like that, if you can update your drivers or upgrade to a better adapter, it might also prevent this error.

0 Kudos
Message 4 of 6
(57 Views)

FaIlingDawn_0-1758574463819.png

 

This is what I'm doing currently, but I think your suggestion of upgrading adapters might help. Will give it a try, thanks!

 

I noticed today the COM port was dead, so if I go to the device manager and disable then enable the COM, the VI will work again.

 

Might just need to reset the COM if the error message pops up.

 

0 Kudos
Message 5 of 6
(49 Views)

OK, now that there's a screenshot I see that, but you do have 3 other interesting things to note.

 

First, you're running a "VISA Clear" at the start.  If you are doing this under the assumption it clears out the buffers, you're sort of correct, but it does something else.  This is from the help file:

Kyle97330_0-1758587091033.png

A "break" does send something over the serial line.  If the instrument on the other end doesn't know what to do with a "Break" signal, it can cause problems.  If all you really want is to flush the buffers, there's a different command, "VISA Flush I/O Buffer", that only flushes the buffer without sending the break.

 

Second, you're running "VISA Configure serial port" every loop.  It's possible, especially with a cheap serial adapter, that the constant setting of baud rate and such being sent to the port's hardware is causing the problem, or causing it to happen sooner.  I would move that out of the loop as well.

 

Third, you're repeatedly using a "Bytes at port" serial property node.  This is generally considered poor practice.  99% of devices are set up to end their transmission with a termination character (which can be configured using "VISA Configure serial port" to be used automatically), and the 0.9% of the remaining 1% are set up to either always send the same number of bytes or to have another method that can be used to tell when the transmission ends (such as having the first byte of every transmission be the length of the transmission).

 

This video is commonly recommended to anyone using "Bytes at port" if they need more information.  Right now you wait 0.2 seconds after each command to get a response when it could be that you could get that wait time down to as low as 1% of that (2 ms) depending how fast the target device replies.

0 Kudos
Message 6 of 6
(39 Views)