Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

34401 Query Problem

I have several instruments on the GPIB bus, the following function works just fine with all instruments except for HP34401.
I have tried both standard 488 and 488.2(commented out ) commands , instrument beeps an error anytime I query (  using "?")
I am using Measurement Computing GPIB card and LabWindows CVI 8.  Standard commands work just fine, only queries to this
intrument cause an error..
hHpib = ibfind("GPIB0");    // Get Handle Of card
//SendIFC(0);     // Reset Board - force it ias controller
int GPIBQuery(int address, unsigned char *write_buffer, char *read_buffer)
 int gpib_error,device;
 int BytesToRead = 80;
 // acquire device
 device = ibdev (0, address, NO_SAD, T1s, 1, 0);
 ibwrt (device, (unsigned char *)write_buffer, strlen(write_buffer));
ibrd (device, read_buffer, BytesToRead);
0 Kudos
Message 1 of 25

Does the Measurement Computing GPIB card  come with an utililty like NI MAX , which allows you to send GPIB commands interactively to the device and does that work ? 

And also check that the 34401 command language is really set to SCPI and not to emulate either a 3478A or a Fluke 8840A.

0 Kudos
Message 2 of 25
Hello SpidyMan,
       I recommend that you download and use the CVI Plug and Play driver that is available on the Instrument Driver Network.  It implements most, if not all, of the functions that you would need programmatic control over, and it saves you the effort of learning the instruments command set.


0 Kudos
Message 3 of 25

I have verified proper operation through VISA Interactive Control/NI Spy, so I do know that the commands do work.  Given this, and the fact that I do have 2 of these intruments, I am sure my problem lies with my code, or use of commands.  This function only has this problem with this intruments.  I have other intruments (e3649, Sorenson, Belhman) and they all respond to all queries with this function.  Something is different about the 34401 that is causing my problem or I need to update my code. 

As far as the set language, there is an option on the 34401 to set it to GPIB, RS232.  I have checked this and it is set to 34401.   Again, this instrument does respond to commands such as set to AC or DC and so on.  The function I use for this is very similar to the one posted.

Yes, I do have this driver, but because I have other instruments on this bus which do not have drivers ( VISA or not ), I decided to go through low level 488 commands.  I have done this many times in the past with no issues and typically use low level commands.  I did however, go through this driver, to make sure that I was using the correct commands ( which do match not only to manual, but to VISA commands).

I think my problem lies in the command Termination, I have tried several options but always get an error on queries.

I am up against a major schedule deadline and willing to try anything at this point.

Thank U both for your response.


0 Kudos
Message 4 of 25

Hi Diego,

I had the same problem (beep, error..) using that scpi query command with the 34401a.

My solution was to send set the function, send "VOLT:AC" then just query using the "READ?" command.

Hope this helps


0 Kudos
Message 5 of 25


Thanks for your response.

I have tried several different ways to make the measurement, including READ, FETCH and MEAS.  The error occurs when I add "?" to the command ( to query), regardless of which command I use.

However, I will admit I have not tried your particular suggestion of using VOLT:AC and then READ... I have tried CONF:VOLT:AC, then READ or MEAS:VOLT:AC?... of course got beep/error on both.  I prolly should try *IDN? and see what happens.


0 Kudos
Message 6 of 25

Hi Diego,

Have you tried increasing the timeout value to 3sec or 10sec instead of 1sec?


0 Kudos
Message 7 of 25
Yes I have, I have also tried different terminations such as 0, 1 and 2.. I have to look at the .h file for descriptions of those terminators.
I should note, and I apologize if I didnt, that the error/beeps occurs when I send (either SEND or IBWRT) the portion of the Query, not when I read ( RECEIVE or IBRD) after the send portion.
Interestingly enough, after the send command ( and error/beep ) I check for errors with IBERR and get a response of 0.  However, when the Read command follows, I do get an error of 6, which is operation halted error.
I have also tried to add delays between all of these commands to no avail.
When I do use he low level 488 commands ( IBWRT and IBRD), I can get it to work maybe %10 and it is very intermittent.
0 Kudos
Message 8 of 25
Digging through these forums, I found the following:
"Also the typical operation model of 34401A is, the instrument requires to be "remote" state for remote measurement.  Immediately after booting up the instrument, it is "local" as default but can be switched to enabled state by SYSTem:REMote\n command is sent.  Under "local" state, the instrument never accepts measurement commands such as INITiate/MEASure/FETCh etc... causing a command execution error.   This may cause a timeout error when attempting to MEASure while in "local" state.  (I don't know if the recent 34410A remains the same architecture."
This seems to describe a similar issue to mine.  I admit I did not include the REMote command and will try it later today.. I hope this translates into me being and idiot and this easy issue to fix.
0 Kudos
Message 9 of 25
Reading through manual, The SYSTEM:REMOTE command is related to only RS232 control so I dont think the above post will work, but I'll try it.
0 Kudos
Message 10 of 25