Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i obtain an ivi handle from a DC Power supply?

I am new to the IVI community.  I have been using PNP drivers in the past.  My first exposure to IVI drivers left me a little confused.  With VISA PNP drivers, there was always a handle to the instrument.  In IVI, I don't understand how the handle or session to the instrument is used.
 
I want to use a DC power supply.  How do I get the handle to the instrument and pass it back to the client? 
 
thanks 
0 Kudos
Message 1 of 9
(4,758 Views)

Both PNP driver and IVI-C driver use the <prefix>_init() function to acquire a new instrument session handle.  Threfore you can acquire the handle in the same manner.  However there is a big difference regarding session handle.

PNP session handle is exactly the same as VISA handle, which can be directly passed to VISA functions such as viPrintf(), viWrite(), viClear(), etc. IVI-C session handle is a true IVI session handle generated by the IVI engine and not VISA's, and can't be passed to VISA functions.  Instead, the <prefix>_WriteInstrData() and <prefix>_ReadInstrData() functions are provided to support pass-through IOs in IVI-C.

0 Kudos
Message 2 of 9
(4,746 Views)

Hello,

What programming language are you using to communicate through IVI?

Here is a tutorial on how to set up your IVI System through Measurement and Automation Explorer (MAX).

Using Measurement & Automation Explorer to Configure Your IVI System

The basic steps are simple...

1.  Expand IVI Drivers under Devices and Interfaces
2.  Right-click on Logical Names and select Create New...
3.  Type in the name of your logical name
4.  In the window in the right, use the drop-down box to associate that logical name with the correct driver session (whatever instrument-specific driver you are using with IVI)
5.  Save the configuration

Now you can create a control off of the IVI VIs in LabVIEW and have your logical name appear in the drop-down box.  For instance, you can create a logical name called MyDmm, and then associate it with a specific driver session (an HP DMM, for instance).  Then make a LabVIEW program using the IVI Digital Multimeter palette, and use this logical name as the input.  Later, if you want to switch to a different DMM, simply go into MAX and select a different driver session for the MyDmm logical name.  The code should work the same without any changes!

If you have anything to configure for the specific driver session, you can play with the options under Driver Sessions in MAX.

Hope this helps!

john m
Applications Engineer

 
0 Kudos
Message 3 of 9
(4,730 Views)

Hi...thanks for helping.

 

I am using C++, the driver is an IVI-COM.  I can talk to the instrument, I'm just not sure how I should keep track of each "channel" on the instrument.

0 Kudos
Message 4 of 9
(4,726 Views)
Hello,

I'm guessing since you say you can talk to the instrument, that you have resolved the instrument handle issue.  Is this correct?

Also, where did you obtain the IVI-COM driver?

john m
0 Kudos
Message 5 of 9
(4,710 Views)
When using an IVI-COM driver, it does not have an IVI session handle. Back to the first question, assuming you could the handle from the driver, what do you want to do?
0 Kudos
Message 6 of 9
(4,700 Views)
What instrument are you using?  Is there an IVI-C driver available?  Depending on how much or little COM you know, it may be easier to call the IVI-C driver from C++.
0 Kudos
Message 7 of 9
(4,689 Views)

hi...

I wrote a wrapper DLL in C++ to interface a client (C) to the dc supply(IVI-COM). I have no problem communicating with the dcps. 

Lets say my wrapper exports these functions:

setup(), and reset(). In every function, I create and destroy the dcps object. I just don't think that it is the best way to do this.  What if there are 10 channels on the dcps, and I want to program each independantly? I would call the same function for every channel.  

Example:

I invoke the function setup() for channel 1; the function initializes and setup the signal for channel 1.

When I invoke the function reset() on channel 1, the function initializes channel 1 again and then I reset it.

The initialization has to happen all the time, I don't want that. I want to initialize channel 1 once when I call setup() or initialize(), then any future action on channel 1 would not have to initialize it again.   I want to retain that session handle so that I could pass it to the any function later. Then those functions would just do what they are intended for, like reset or setcurrent or setvoltage; not initialize everytime.

Maybe I'm not asking the right question. Thanks for your responses everyone, and sorry for my lack of understanding of the IVI drivers.

 

 

0 Kudos
Message 8 of 9
(4,681 Views)
Normally you do noty have to wrap IVI-COM driver with your own C++ code.  Assuming you are using Microsoft VC++, the #import directive will machine-generate the C++ Smart Pointer wrapper (.tlh and .tli files), then you can program through the Smart Pointer class.
 
Initializing the IVI-COM driver (invoking Initialize() method) for each access of channels is very wasting and not a good way, because the Initialize() method of an IVI-COM driver does much more than you think including lots of initial VISA calls and IO trafic, even if IdQuery and Reset parameters are set to FALSE.  Instead, it is better to keep the interface pointer of the Output object for each channel.  You can acquire one or more Output objects (correctly COM interface pointers to the Output objects) through the Outputs collection with the given channel names.  Although there is no explicit HANDLE for an Output object, you can still keep track with it by keeping the Interface pointer and object's reference count.  Therefore the instrument session that is opened with Initialize() call can be kept open during all the jobs you want to apply to your DC supplies.
 
The Interface Pointer and object refenence count can be managed in a "smart" way by using VC++ Smart Pointer feature.
0 Kudos
Message 9 of 9
(4,666 Views)