Search code examples
delphilabviewdelphi-xe7gpib

Unable to read from Agilent 53131A by GPIB in the simple way


Hi I am using LabView 2012, Delphi XE7 and GPIB (I think 488.2), Win7 SP1 and Agilent 53131A.

I used the given NI examples.

NI Labview example - Found in LabVIEW's help - GPIB.vi.

I tried writing and reading to query frequencies from 2 channels and they are successful. They are are sent and read in succession.

  1. *IDN?
  2. :FUNC 'FREQ 1'
  3. :READ:FREQ?

If they are successful, that meant GPIB for Agilent and NI MAX and driver are successfully installed and configured.

I am also able to use KeySight Connection Expert's to write and read, Again it is also successful.

However, When I used the given NI example in Delphi. Orginally it was saved as Delphi 3 or 4.

I used the Scope Simple example for universal counter. I used it mostly for writing and reading in the simple way. All it needs initialization, read/write and cleanup

I changed the following codes as shown below, in SimpleForm.pas

The detected device is at GPIB0::3::INSTR so, at line 32,

PRIMARY_ADDR_OF_COUNTER = 3;  

String to write and read so, at line 132,

CommandBox.Text := '*IDN?';

then it was compiled with no error and run.

String to write was successfully

But upon reading, it was not successfully. The string output is supposed to be ' HEWLETT-PACKARD,53131A,0,4806'.

The error at the end of the program is as follows below:-

Unable to read from device
ibsta = SC000 <ERR TMO>
iberr = 6 <EABO>
ibcntl = 0

From these readings, I figured out as :-

EABO means abort

I am not familiar with working of GPIB. Kindly advise.


Solution

  • You are correct that EABO is the identifier for an abort. In addition, we can see from ibsta = SC000 <ERR TMO> that the cause of the abort was a GPIB timeout error. I am not familiar with Keysight Connection Expert or your instrument, but since the error was from GPIB timeout, the most likely causes are:

    1. The query was improperly formatted and the instrument thought it was just a write statement with no response needed. (That's probably why the write function had no error, but the read function timed out.)
    2. The query was improperly formatted and the instrument returned an error.
    3. Instrument needs to have 'Talker' capability enabled to send data. (Most instruments do this automatically with queries.)

    For more information on generic GPIB commands, see this reference from the folks at National Instruments.