Checking Usb Connection - Agilent Technologies N9340B Programmer's Manual

Spectrum analyzer
Table of Contents

Advertisement

Checking USB Connection

N9340B Programmer's Guide
Usually, using
"*IDN?"
between the controller PC and the instrument.
****************************************************
#include "visa.h"
#include <stdio.h>
#define BufferSize 128
static ViStatus status;
static ViSession defaultRM;
static ViSession inst_N9340B;
static ViUInt32 rcount;
static unsigned char buffer[BufferSize];
int main(void)
{
/* Connect N9340B and read its "IDN". */
status = viOpenDefaultRM (&defaultRM);
status = viOpen (defaultRM,
"USB0::2391::8472::0000000000::0::INSTR", VI_NULL,
VI_NULL, &inst_N9340B);
if (status != VI_SUCCESS)
return -1; //failed to connect N9340B/
/* Read "IDN" from N9340B" */
status = viWrite (inst_N9340B, "*RST\n",
StringLength("*RST\n"), &rcount);
status = viWrite (inst_N9340B, "*IDN?\n",
StringLength("*IDN?\n"), &rcount);
status = viRead (inst_N9340B, buffer, BufferSize,
&rcount);
/* Close connection to N9340B. */
status = viClose (inst_N9340B);
status = viClose (defaultRM); return 1;
}
Programming Example
verifies the data transferring
4
39

Advertisement

Table of Contents
loading

Table of Contents