Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Performing a Vi_Lock in an IVI Driver

I am using the Tektronix AWG520 IVI-C Driver. Here is the scenario of events: I call the Initialize function to obtain a vi session. It appears that this vi session is "owned" by the driver now. As soon as I attempt to write anything to the instrument through GPIB commands using that vi session, I get an error message saying that the session is invalid. I am assuming this is because the IVI driver is either not releasing the vi session or is releasing a sort of masked vi session. Does anyone know if this is the case? I have tried a couple of things to get this result: The first thing I tried was writing an identify function that would use the function vi_write to write the *IDN? query to the instrument. This did not wor
k. Now I am trying to do something simpler, by just trying to send the vi_lock command to the instrument. I get the same error that the vi session is not valid. Is there any possible way to get around these "problems" with the IVI driver? Any help in this matter is greatly appreciated! Thanks in advance.
0 Kudos
Message 1 of 3
(3,364 Views)
Hi,

It seems that your are trying to use the IVI session handle to perform I/O operations. An IVI session is initialize using the Ivi_SpecificDriverNew function. From the function help:

"Note: This function does not create a VISA session to any instrument resources. If you use VISA to communicate to the instrument, you must create a VISA session yourself and set the IVI_ATTR_IO_SESSION attribute to that value. Otherwise, you can use the IVI_ATTR_IO_SESSION attribute to hold a handle to whatever communications resource you use."


Look at the callback functions as a reference for instrument I/O. First the session is locked and then the IO VISA handle is obtained using Ivi_IOSession. This function returns the VISA handle stored in IVI_ATTR_IO_SESSION.
The driver needs to initialize this attribute with a valid I/O handle (usually VISA).
The tkawg5x0_IviInit function in this driver initializes the attribute by calling viOpen.

Hope this helps.

DiegoF.
National Instruments
0 Kudos
Message 2 of 3
(3,364 Views)
Hi DP,

An IVI session is a VISA resource manager session and not a VISA IO session. The Ivi_LockSession function actually locks the resource not the session.

Are you using the driver only to get a session? If you want to write directly to the instrument, you should be using the Write and Read Instrument Data functions.

Thanks!
0 Kudos
Message 3 of 3
(3,364 Views)