Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Passthrough functions in IVI COM

I'm creating a TestStand custom step using Labwindows/CVI. The step will control an Agilent Rf Signal Generator and I have to use their IVI-COM driver. One of the instrument functions isn't covered by the driver (Set Phase). I brought this to their (Agilent's) attention and asked for a workaround solution (along the line of a VXIPNP Passthrough function for sending SCPI strings). This was their response:

******
If there is a need for an instrument command which is not present in the driver, one can use the WriteString() method to send a general SCPI command to the instrument. Here is this example of how the RF Signal Generator IVI base class driver can send SCPI directly to the instrument.

spRfSigGen->System->IO->WriteString(_bstr_t(":AM:INT:FREQ 2.0e03 Hz"),true);
spRfSigGen->System->IO->WriteString(_bstr_t(":AM:INT:FUNC TRI"),true);

The available SCPI commands are found in the SCPI Command Reference for the instrument.
*******

Basically the question is can anyone convert this into LabWindow/CVI ?????????

I have created and Active X controller (using the wizard) for their IVI COM driver type library and have traversed the object tree
driverObj->SystemObj->IOObj where does one go after that to actually write a string? I also created An Active X controller for the visacom type library and tried this function

static int RFsigGen_SetPhase(CAObjHandle driverObj)
{

CAObjHandle systemObj = 0;
CAObjHandle IOObj = 0;
int error = 0;

error = AgilentRfSigGenLib_IAgilentRfSigGenGetSystem (driverObj, NULL, &systemObj);

if (error == 0)
error = AgilentRfSigGenLib_IAgilentRfSigGenSystemGetIO (systemObj, NULL, &IOObj);

if (error == 0)
error = VisaComLib_IMessageWriteString (IOObj, NULL, ":PHAS:REF", NULL);

if (error == 0)
error = VisaComLib_IMessageWriteString (IOObj, NULL, ":PHAS 30DEG", NULL);

return error;
}

Not surprisingly and error is returned at VisaComLib_IMessageWriteString (IOObj, NULL, ":PHAS:REF", NULL);

Can anyone put me on the right track ?

Cheers
DWW
0 Kudos
Message 1 of 20
(5,939 Views)
Are you using an ESG or PSG series RF Signal Generator? There is an IVI-C driver available for the ESG series on the Instrument Driver Network:
http://sine.ni.com/apps/we/niid_web_display.download_page?p_id_guid=E3B19B3E90ED659CE034080020E74861

This driver is more likely full featured, but if it does not have the functionality a passthrough function is provided.

Currently, there is no IVI-C driver for the PSG series but this is something that we are interested in developing if we could obtain the instrument.

Jason Hobbs
0 Kudos
Message 2 of 20
(5,923 Views)
DWW,

Actually, all LabWindows/CVI drivers have 'pass-through' functions. These are named prefix_WriteInstrData() and prefix_ReadInstrData(). They will most likely be available on the ESG series drivers as well.

ZH
0 Kudos
Message 3 of 20
(5,914 Views)
As others are saying, IVI-C or VXIpnp driver is much easier for the CVI environment if the driver is available for your instrument. The pass through feature is provided by prefix_WriteInstrData() function (IVI-C case) or you can just pass the driver session to viPrintf() or viWrite() function (VXIpnp case).

Assuming that you continue to use the IVI-COM driver, what error code is returned from what line? Depending on the error code, such as IVI-COM error code, VISA-COM error code, or Windows system HRESULT, the cause may be different.

makoto
0 Kudos
Message 4 of 20
(5,904 Views)
All
0 Kudos
Message 5 of 20
(5,892 Views)
All
0 Kudos
Message 6 of 20
(5,891 Views)
All
Thanks for your responses - It is a PSG series instrument and I am constrained to using the IVI COM driver, trust me I wouldn't touch it with a barge pole if I had a choice. I think my problem has it roots in the obvious disdain that NI have for IVI COM (refer to my query on IVI COM and the NI Session Manager) and the equal lack of support that Agilent provide for NI products i.e. you can get any number of examples if you program in VB or VC++ but try and get an example in CVI. Even NI have demoted CVI to the bottom of the pile, if it is mentioned at all (check out the help for the TestStand API if you don't believe me !!)


DWW
0 Kudos
Message 7 of 20
(5,882 Views)
Hello DWW


I understand that fact that using COM from CVI is not a trivial matter and requires the user to be really familiar with the technology in some cases. But this is due to the nature of the technology, and not really because NI's support for CVI users. We are always looking for ways to improve CVI. And customer feedback is definitely an invaluable means of making sure that the user experience with CVI gets better as we move forward.

It would really help if you could provide info about the kind of error you're running into. Besides the return value, you can get additional information by using the ErrorInfo parameter of the function causing the problem instead of passing NULL to it. You can then use the CA_DisplayErrorInfo() function to display the info returned by ErrorInfo.
Bilal Durrani
NI
0 Kudos
Message 8 of 20
(5,857 Views)
Bilal

Thanks for your response. The error code returned is -2147467262, "Unknown Error". On getting this error, with for example the TestStand API, I would perservere until getting to the root of the problem, but in this case I need to know if I'm on the right track. Is it possible to pass a handle generated in one library to a function from a different library - as a I am attempting ?


Regards
DWW
0 Kudos
Message 9 of 20
(5,844 Views)
Ok, I think I know what the problem is. You're not using the correct interface. The error number you returned is a COM error E_NOINTERFACE (x80004002), which means that the interface is not supported. I checked out the help for the IAgilentRfSigGenSystem.IO property (which is what returns the IO object), and it returns the IFormattedIO488 interface. So instead of using the IMessage WriteString, try using VisaComLib_IFormattedIO488WriteString().

I hope this helps
Bilal Durrani
NI
0 Kudos
Message 10 of 20
(5,819 Views)