Technical data
988 Agilent Infiniium 90000 Series Oscilloscopes Programmer's Reference
35 Sample Programs
err = viFlush(vi, VI_READ_BUF);
if (err != VI_SUCCESS) error_handler();
err = viFlush(vi, VI_WRITE_BUF);
if (err != VI_SUCCESS) error_handler();
}
}
/* Handle VISA errors.
* --------------------------------------------------------------- */
void 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);
}
}
VISA Example in Visual Basic
To run this example in Visual Basic for Applications:
1 Start the application that provides Visual Basic for Applications (for
example, Microsoft Excel).
2 Press ALT+F11 to launch the Visual Basic editor.
3 Add the visa32.bas file to your project:
a Choose File>Import File....
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.
4 Choose Insert>Module.
5 Cut- and- paste the code that follows into the editor.
6 Edit the program to use the VISA address of your oscilloscope, and save
the changes.
7 Run the program.
'
' 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 ' Error returned by VISA function calls.
Public drm As Long ' Session to Default Resource Manager.