Visa Example In Visual Basic - Agilent Technologies Infiniium 90000 Series Programmer's Manual

Oscilloscopes
Hide thumbs Also See for Infiniium 90000 Series:
Table of Contents

Advertisement

38
Sample Programs
}
/* Handle VISA errors.
* --------------------------------------------------------------- */
void error_handler()
{
}

VISA Example in Visual Basic

To run this example in Visual Basic for Applications:
1
2
3
4
5
6
7
'
' Agilent VISA Example in Visual Basic
' -------------------------------------------------------------------
' This program illustrates a few commonly-used programming
' features of your Agilent Infiniium Series oscilloscope.
' -------------------------------------------------------------------
Option Explicit
Public err As Long
Public drm As Long
1068
err = viFlush(vi, VI_READ_BUF);
if (err != VI_SUCCESS) error_handler();
err = viFlush(vi, VI_WRITE_BUF);
if (err != VI_SUCCESS) error_handler();
}
char err_msg[1024] = {0};
viStatusDesc(vi, err, err_msg);
printf("VISA Error: %s\n", err_msg);
if (err < VI_SUCCESS)
{
exit(1);
}
Start the application that provides Visual Basic for Applications (for
example, Microsoft Excel).
Press ALT+F11 to launch the Visual Basic editor.
Add the visa32.bas file to your project:
Choose File>Import File....
a
b
Navigate to the header file, visa32.bas (installed with Agilent IO
Libraries Suite and found in the Program Files\IVI Foundation\VISA\
WinNT\include), select it, and click Open.
Choose Insert>Module.
Cut- and- paste the code that follows into the editor.
Edit the program to use the VISA address of your oscilloscope, and save
the changes.
Run the program.
' Error returned by VISA function calls.
' Session to Default Resource Manager.
Agilent Infiniium 90000 Series Oscilloscopes Programmer's Reference

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents