HP 8903B HPIB/GPIB read problems

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Dear All,

There is a problem specific with the 8903B in responding to a data read request on the GPIB with a HP GPIB PC card as it doesn't terminate the string properly.

The following was some code I started on...

=============================================

HP 82350B PCI GPIB card << >> HP 8903B Audio Analyser

Agilent IO Libraries Suite 16.2

MS Visual Studio Express C# v10

N.B. Don't forget to add visa32.cs into project.

Intel box running Windows 7 64bit OS


This following is just the code routine called from a button click, all the other stuff needs to be wrapped around it of course (I hacked one of the Agilent C# examples for the framework).

Trying to put the central command and reading bit into a loop doesn't work for the second reading so there is still a buffer unflushed or something.

However since each measurement cycle of the analyser is so slow (compared to the computer side of things) actually opening and closing for each read, whilst against the grain, isn't going to make any odds to the overall speed of operation of the analyser.

If anyone get any further with this, can you email me direct as well as to the forum. Thanks.

Best wishes,
Susan.


====== C# Code Snippet =======

// The following example reads one result from the HP8903B at GPIB address 28
// Susan Parker - September 2012

private void btnConfigure_Click(object sender, System.EventArgs e)
{

try
{
int resourceManager = 0, viError;
int session = 0;
byte[] inputchar = new byte[20];
int VI_ATTR_TERMCHAR = 0x3FFF0018;
int VI_ATTR_TERMCHAR_EN = 0x3FFF0038;

System.Text.StringBuilder idnString = new System.Text.StringBuilder(20);

/* Open connection */

viError = visa32.viOpenDefaultRM(out resourceManager);

viError = visa32.viOpen(resourceManager, "GPIB0::28::INSTR", visa32.VI_NO_LOCK, visa32.VI_TMO_IMMEDIATE, out session);

/* Enable Termination char and set value */

viError = visa32.viSetAttribute(session, VI_ATTR_TERMCHAR_EN, 1);

viError = visa32.viSetAttribute(session, VI_ATTR_TERMCHAR, 0x0A);

/* Set up instrument */

viError = visa32.viPrintf(session, "M1\n"); // AC level
viError = visa32.viPrintf(session, "L0\n"); // LP filters OFF
viError = visa32.viPrintf(session, "AP1.0VL\n"); // Amplitude Output
viError = visa32.viPrintf(session, "FR680HZ\n"); // Frequency

/* Trigger */

viError = visa32.viPrintf(session, "T3\n"); // Trigger with Settling

/* Read results */

viError = visa32.viScanf(session, "%20s", idnString);

/* Print results */

txtResult.Text = idnString + " Volts AC rms\n"; // Here we go :)

/* Close session to flush buffer otherwise next reading won't work !!! */

visa32.viClose(session);

visa32.viClose(resourceManager);

}

catch(SystemException ex)
{
btnConfigure.Enabled = true;
btnMeasure.Enabled = true;
MessageBox.Show("Command failed. " + ex.Source + " " + ex.Message, "GPIBMeasConfig", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

}

====== END of Code Snippet =======
 
Problem solved for read problems on HP8903B

I also had the same problem with reading the value back from the HP8903B. My system is Windows 10, USB to GPIB 82357B, Delphi and Keysight IO libraries 17.3.

I ran Pete Millet's software on my system and watched the GPIB transfers using the Keysight IO monitor. This showed that VISA viLock and viUnlock were being used during the viWrite and viRead. I subsequently found that just using viLock during the HP8903B initialization allowed data to be read from the instrument.

Hope this helps.
 
8903B, GPIB, Pete Millett Sweep Software

I had success today connecting the 8903B to Pete Millett’s software via GPIB on a Windows 10 PC.


Attached are the software resources I installed based on Pete Millett's instructions. Thought I'd try the latest non-licensed Agilent/Keysight Libraries & VEE Runtime utilities - they seemed to work.



Also turned "Auto-Scan Options" off otherwise local control goes back to remote when the instrument is polled for presence every few seconds.


I did change the instrument alias to "Audio Analyzer" and the adapter GPIB address to "14" in the Connection Expert "Edit Settings" panel.
 

Attachments

  • Setup Software etc..doc
    100.5 KB · Views: 115
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.