9Programming Examples
VISA Example in Visual Basic
'
'Agilent VISA Example in Visual Basic
'
'This program illustrates most of the
'features of your Agilent oscilloscope.
' |
|
|
|
| |
Option Explicit |
|
|
|
|
|
Public err As Long | ' Error returned by VISA | function calls. | |||
Public drm As Long | ' | Session | to | Default Resource Manager. | |
Public vi As Long | ' | Session | to | instrument. |
|
'Declare variables to hold numeric values returned by
'viVScanf/viVQueryf.
Public dblQueryResult As Double
Public Const DblArraySize = 20
Public Const ByteArraySize = 5000000
Public retCount As Long
Public dblArray(DblArraySize) As Double
Public byteArray(ByteArraySize) As Byte
Public paramsArray(2) As Long
'Declare fixed length string variable to hold string value returned
'by viVScanf/viVQueryf.
Public strQueryResult As String * 200
'
'MAIN PROGRAM
'
'This example shows the fundamental parts of a program (initialize,
'capture, analyze).
'
'The commands sent to the oscilloscope are written in both long and
'short form. Both forms are acceptable.
'
'The input signal is the probe compensation signal from the front
'panel of the oscilloscope connected to channel 1.
'
'If you are using a different signal or different channels, these
'commands may not work as explained in the comments.
'
Sub Main()
'Open the default resource manager session. err = viOpenDefaultRM(drm)
'Open the session to the resource.
'The "GPIB0" parameter is the VISA Interface name to
'an GPIB instrument as defined in:
'
'Change this name to whatever you have defined for your
568 | Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Reference |