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: 

HP 6632A - set voltage - Labwindows CVI

Solved!
Go to solution

Hello everyone,

 

I am trying to set the voltage of HP 6632A using Labwindows CVI. The initialization succeeds (1) if no id query and no reset command is send and fails (2) if both is send (Bus error occurred during transfer) (see update below); alos when I try to configure/set the output using the function below, I get an error code BFFF0038 - Bus Error occurred during transfer (1) or BFFF000E  - Invalid session handle (2).

 

I checked tha MAX and the GPIB address there matches with what is shown on the power supply. It also responds to the id query there.  I am using the Instrument driver provided by NI to talk to the device through USB-GPIB converter from NI.

 

Am I missing a step here? Do I need to configure the device in a certain way before using it?

 

Thanks!

 

 

// Initialization (sending Id request and reset command)
    int error_int = hpe363xa_init( "GPIB::0", VI_ON, VI_ON, &g_instrumentHandle1 );
    char error_string[100];
    Fmt( error_string, "%x", error_int );

    MessagePopup( "Return Value Init", error_string );  // <- ERROR BFFF0038  Bus error occurred during transfer

// Config to enable output
    error_int = hpe363xa_configOutput3632( g_instrumentHandle1, VI_OFF );
	
    Fmt( error_string, "%x", error_int );
    MessagePopup( "Return Value Config", error_string );  // <- ERROR BFFF000E  Invalid session handle

// Set Voltage to 12 V	
    error_int = hpe363xa_outputSetOperate3632( g_instrumentHandle1, VI_OFF, 12.0, 1.0, VI_ON );
	
    Fmt( error_string, "%x", error_int );
    MessagePopup( "Return Value Set", error_string );  // <- ERROR BFFF000E  Invalid session handle

 

 

 

Device: HP 6632A DC Power Supply via Labwindows CVI.

Connection: NI GPIB-USB connection cable

Driver: Labwindows Plug&Play

Language: Labwindows 2013

OS: Windows 7

 

Edit1:

I just realized that I am not sending an id query and an reset command when initializing the device. I updated the code above. Unfortunately I get an error code if I do this and the devicehandle is not set! The set functions following are failing subsequently.

 

 

 

 

 

0 Kudos
Message 1 of 6
(5,748 Views)
The resource name of GPIB::0 would be the default address of the controller. You should not have address 0 for any instrument.
0 Kudos
Message 2 of 6
(5,737 Views)

Thanks, I was not aware of that!

 

In MAX I changed it to GPIB1. The primary address is 5. Secondary address is disabled.

On the device side I changed the address also to 5.

 

Now, when I use the VISA Interactive Control to check the communication (same parameters as above) I get the following error:

Write Operation (*IDN?\n)
Error

VISA: (Hex 0xBFFF003A) Unable to start operation because setup is invalid (due to attributes being set to an inconsistent state).

 

I need to look into that a little more. Any suggestions are more than welcome.

 

Thanks,

ZMM

0 Kudos
Message 3 of 6
(5,720 Views)
Changing it to GPIB1 makes no sense. Changing the controller address to 5 makes no sense. Changing the instrument to also be 5 makes no sense. The controller should be GPIB0 with an address of 0. The instrument MUST be a different address. Leave it at 5.

Please find a basic GPIB tutorial.
0 Kudos
Message 4 of 6
(5,694 Views)
Solution
Accepted by topic author ZerMahlMeer

You are also using the wrong instrument driver for a HP6632A. The hpe363xa driver is for the E3631A,E3632A and E3634A models.

You should use the driver available at http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=E3B19B3E929C659CE034080020E748... instead.

0 Kudos
Message 5 of 6
(5,645 Views)

Oops..thanks for pointing that out.

 

It is working fine now. Thanks for y'all's support!

 

Here's a quick summary of what I read/did:

 

Driver HP6632A

 

Reads

Installing GPIB-USB Controllers

Video: Instrument Control in Windows with GPIB: Set-up and Configuration

Scan for Instruments fail in MAX

Video: General GPIB tutorial

 

Code example

 

//==============================================================================
// Global variables
int g_instrumentHandle1 = 0;

// initialize devicve
int Hp363xa_init( void )
{
    int ret_val = FAILURE;
    int error_int = hp6xxxa_init( "GPIB0::5::INSTR",     // name from MAX
	                           VI_ON,                // send id query
				   VI_ON,                // reset device 
				   11,			 // HP6632A name 
				   &g_instrumentHandle1  // handle after init 
				);
    char error_string[100];
    Fmt( error_string, "%x", error_int );

    MessagePopup( "Return Value Init", error_string );
    return ret_val;
}

// set and read back voltage
int Hp3632a_SetAndReadVoltage( void )
{
    int ret_val = FAILURE;
    double measured_amp = 0;
    double measured_volt = 0;
	
    char error_string[100];  
	
    int error_int = hp6xxxa_app_func( g_instrumentHandle1,  // handle to instrument
				      1,                    // channel not valid for this instrument
				      12.0,		    // voltage set [V]
				      0.5,	            // current set [A]
			              0.5,		    // set dealy time [s]
				      &measured_volt,	    // read back volt
			              &measured_amp	    // read back amp
				    );  

    Fmt( error_string, "%s: %x\n%s: %f\n%s: %f\n",
	 "Error code"      ,   error_int      ,
	 "Voltage measured",   measured_volt  ,
	 "Current measured",   measured_amp 
       );
	
    MessagePopup( "Return Value Config", error_string );

    return ret_val;
}

 

0 Kudos
Message 6 of 6
(5,616 Views)