07-31-2015 10:03 AM - edited 07-31-2015 10:30 AM
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.
Solved! Go to Solution.
07-31-2015 10:41 AM
07-31-2015 11:55 AM
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
07-31-2015 01:32 PM
08-02-2015 11:38 PM
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.
08-03-2015 11:03 AM - edited 08-03-2015 11:20 AM
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:
Reads
Installing GPIB-USB Controllers
Video: Instrument Control in Windows with GPIB: Set-up and Configuration
Scan for Instruments fail in MAX
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; }