Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-MAX VISA Resource viLock, IDN? and viUnlock and VXI-11 instruments

Solved!
Go to solution

I have a list of VXI-11 intruments that recognize TCPIP resource strings of this form "TCPIP0::10.AA.BB.CC::INST1::INSTR" with different IP addresses. I connect to these VXI-11 devices manually in NI-MAX Network Devices Tree and open a session. I closed NI-MAX and later I restart it. The NI Trace shows that any time I open NI-MAX it will automatically search for instruments of my previous TCPIP list. I could see that each connection send a viLock then an IDN? then viUnlock. The time taken between viLock and viUnlock is around 40 ms but if in this time some other program want to acces my device it will receive "Device not accessible" because NI-MAX locked the device.How may I prevent NI-MAX to start do this automatic search for all VXI-11 devices stored previously in NI-MAX? How may I prevent NI-MAX when searching for VXI-11 device list to send viLock and viUnlock in the sequence: viLock IDN? viUnlock and send only IDN?

0 Kudos
Message 1 of 3
(3,215 Views)
Solution
Accepted by topic author sorinxxxx

Hello sorinxxxx,

 

This behavior in MAX is set by default, and this is not user configurable. The resource has to be locked while MAX is identifying and configuring it. The best practice recommendation for all VISA code is to either include a robust timeout case or handle this interaction during software initialization, especially if you expect interactions like this to occur regularly.

 

For example, if you use a viLock with an infinite timeout in the initialization step of your programs, it will wait for MAX to finish identifying the instrument befor attempting to access it for use in the program, and then take sole control. Alternatively, whenever your program receives the "Device not accessible" message, you could catch that error, have the program wait 40ms, and try again.

 

Best,

Daniel 

 

0 Kudos
Message 2 of 3
(3,169 Views)

Thank you for response. I will consider one of these options you mentioned.

0 Kudos
Message 3 of 3
(3,167 Views)