From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

CWIviDcPower AutoQueryFlags undeclared identifier

I am attempting to set the AutoQuery parameters of a Agilent E3631A DC Supply through IVI. The Measurement Studio Refernce indicates that I can use constants such as "cwividcpowerMeasCurrent" to set the values.

A couple of Visual Basic sample statements are also listed. I am using C++, and the SetAutoQueryFlags() method. It takes a long integer as an argument

void SetAutoQueryFlags(long nNewValue);

I tried to build a value using the constants, but I keep getting error C2065 : undeclared identifier.
The constants are not listed in the _cwividcpower.h header file. I cannot figure out where the constants are defined, or how I am supposed to figure out the value of the long integer I need to use as a paramat
er.
Can somebody point me in the right direction?
0 Kudos
Message 1 of 6
(3,616 Views)
The constant values are not defined as part of the exported interface for the control. However, you can pull the values from the control's property editor. I've included them below:
Query All: -1
Query ConstantVoltage : 1
Query ConstantCurrent: 2
Query OverVoltage : 4
Query OverCurrent: 8
Query Unregulated : 16
Measure Voltage :32
Measure Current :64

The values act as a bit mask, so yo can logical OR them together to query for multiple values.

If you're not using the control's interface in your UI, you might consider using the C++ Measurement Studio API supplied with the IVI Compliance Package 2.0 or later. This API integrates well with other Measurement Studio C++ API's, and might provide you with a more straightforward programming model
than the activeX control, which is intended primarily for use in VB 6.
Message 2 of 6
(3,616 Views)
Thanks Glenn. I had pieced together the constant values by changing the settings in the control's property page, and then using GetAutoQueryFlags() and a breakpoint in my program. I am not familiar with how I could "pull the values form the control's property editor". For future reference, can you explain further?

Also, with regard to using the C++ MS API, . . . I am afraid that I am a C++ newbie. I usually use CVI, but needed access to threads and return values from DOS command line executables. I have one C++ MS project under my belt where I achieved this. What is new to me on this one, is using IVI and a serial interface to a power supply.
I do not need the control's interface, but I have no idea how to get started with "using the C++ Measureme
nt Studio API" as you suggest. It took me quite a bit of effort just to stumble onto installing the IVI stuff and including the Active X control in my project. Could you point me in the right direction?
0 Kudos
Message 3 of 6
(3,616 Views)
I failed to mention a few details, I guess.

To find the possible parameter values, I opened up a VB6 project and added the DcPower control to the form. I then used the property grid to look at all of the possible values for the AutoQueryFlags property.

Before heading down the path of using the C++ API, I'd like to confirm your installation - you said you stumbled on to installing the IVI parts - what exactly did you install? Also, what version of Measurement Studio and Visual Studio are you using? I want to make sure the directions I give you are relevant and correct based on the software you're actually using. Also, if you're happy with using the ActiveX control from VC++, there might not be much reason to switch over to the power
supply's C++ api.
0 Kudos
Message 4 of 6
(3,616 Views)
First, the SW versions:
Measurement Studio 6.0
C++ 6.0.0.105

As for the installations, things were not straightforward and I cannot remember all the details, but here's the synopsis:
1) Download and attempt install of HPE3631A driver, "hpe363xa_MS.msi" from ftp site. Noticed the requirement for IVI 2.1 or greater, and VISA 2.6.0 or better. I had VISA 2.6.0 installed, but IVI toolset was lower rev. Think I tried to run the hpe363xa_MS.msi installer anyway. [Hope springs eternal.]

2) Either the install failed, or I decided to update my SW versions. I downloaded and installed VISA 3.0.1, and I downloaded and attempted to install IVI Compliance Package 2.1, but the IVI installed failed. I entered a question in developers exchang
e
"IVI compliance package 2.1 install error 1714"
but eventually resolved the issue myself before I got a reply by repeatedly attempting to remove IVI 1.83, and then installing IVI CP 2.1.

3) After IVI CP 2.1 installed, ran the power supply .msi installation and opened Measuement Studio C++.

4) Figured out how to add the CWIviDcPower tool to the toolbox and dropped it in my dialog. Now I am working from there. [From your comments, it seems like I had another choice besides using the CWIviDcPower control.... and I am curious to know what/how that option is.]

All of this probably would take only a few hours for an experienced developer, or even less if the SW had already been up to date. But, unfortunately, I do not develop often, and usually use CVI. Plus, this is my first attempt at VISA & IVI. So, it took me a couple days to figure out and stumble through each step.
0 Kudos
Message 5 of 6
(3,616 Views)
With MeasurementStudio installed, using VC6, you should be able to go to the Measurement Studio toolbar and select the "Measurement Studio Add/Remove Components Wizard." This wizard will show you a tree of possible component categories. Under "IVI Class Drivers" you can select "IviDcPwr" - this will add the components to your project to allow you to code to the CNiIviDcPwr class, which is a c++ api wrapped over the IVI C interface. You can find help on this component in the Measurement Studio Reference, under the Visual C++ Help >> reference >> Instrument Drivers >> Class Drivers >> CNiIviDcPwr topic.
0 Kudos
Message 6 of 6
(3,616 Views)