Example Program - Keysight N9320B Programmer's Manual

Spectrum analyzer
Hide thumbs Also See for N9320B:
Table of Contents

Advertisement

Programming Example
Programming in C using the VTL
viRead
viClose

Example Program

42
This function synchronously reads raw data from the session specified by the vi parameter and
stores the result in location where buf is pointing. Only one synchronous read operation can occur
at any one time.
viRead(vi, buf, count, &retCount)
This function must be used to close each session. When you close a device session, all data
structures that had been allocated for the session will be set free. If you close the default
resource manager session, all sessions opened using that resource manager session will be
closed.
viClose(vi);
viClose(defaultRM)
This example program queries a USB device for an identification
string and prints the results. Note that you must change the
address if something other than the default USB address value is
required.
/*idn.c - program filename */
#include "visa.h"
#include <stdio.h>
void main ()
{
/*Open session to USB device */
viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM,"USB0::2391::8472::000
0000000::0::INSTR",VI_NULL,VI_NULL,&viN9320B);
/*Initialize device */
viPrintf(viN9320B,"*RST\n");
/*Send an *IDN? string to the device */
printf(viN9320B, "*IDN?\n");
/*Read results */
viScanf(viN9320B, "%t", &buf);
/*Print results */

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents