9Programming Examples

VISA COM Example in Visual Basic

'

'Agilent VISA COM Example in Visual Basic

'-------------------------------------------------------------------

'This program illustrates most of the commonly used programming

'features of your Agilent oscilloscopes.

' -------------------------------------------------------------------

Option Explicit

Public myMgr As VisaComLib.ResourceManager

Public myScope As VisaComLib.FormattedIO488

Public varQueryResult As Variant

Public strQueryResult As String

'

'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()

On Error GoTo VisaComError

' Create the VISA COM I/O resource.

Set myMgr = New VisaComLib.ResourceManager Set myScope = New VisaComLib.FormattedIO488

' GPIB.

'Set myScope.IO = myMgr.Open("GPIB0::7::INSTR")

' LAN.

'Set myScope.IO = myMgr.Open("TCPIP0::a-mso6102-90541::inst0::INSTR")

' USB.

Set myScope.IO = myMgr.Open("USB0::2391::5970::30D3090541::0::INSTR")

'Initialize - Initialization will start the program with the

'oscilloscope in a known state.

Initialize

'Capture - After initialization, you must make waveform data

'available to analyze. To do this, capture the data using the

578

Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Reference

Page 578
Image 578
Agilent Technologies 5000 Series manual Visa COM Example in Visual Basic, Gpib