Example 7, Vc++ Example - Agilent Technologies 86082A User Manual

Wavelength domain component analyzer
Table of Contents

Advertisement

Example 7, VC++ Example

Description
In VC++ a fast VISA formatting method can be used to acquire the trace. This
method allows you to download the trace as binary (Real32) data and have the
formatting function automatically convert and place the data into an array.
This formatting method is demonstrated in the program below.
Program
#include "visa.h"
#include "visatype.h"
#include <mmsystem.h>
#include <windows.h>
.
.
.
//-- VISA Declarations
ViSession DefRM;
ViSession Inst;
ViStatus status = 0;
ViUInt16 STB = 0;
//-- VISA Return vars
float fData[9601];
short int NumPoints = 9601;
unsigned char PointsStr[5];
//-- Timer Vars (all values are in ms)
long StartTime;
long EndTime;
long ElapsedTime;
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
//-- Open a session to the VISA Resource Manager
status = viOpenDefaultRM(&DefRM);
//Add code to check status for an error
//-- Open a session to the instrument
status = viOpen(DefRM,"GPIB0::23",VI_NULL,3000,&Inst);
//Add code to check status for an error
//-- Map OPC to bit 5 of STB
status = viPrintf(Inst,"*ESE 1\n");
//Add code to check status for an error
//-- Trigger a sweep
status = viPrintf(Inst,"INIT:IMM;*OPC\n");
//Add code to check status for an error
STB = 0;
while (!(STB & 32))
{
Remote Operation
Example Programs
//VISA library 2.2 specification
//VISA type and macro declarations
//for multimedia timer
//for sleep function
//Declare Resource manager
//Instrument session
//9601 is the maximum number of points
5-75

Advertisement

Table of Contents
loading

Table of Contents