Getting Started
3
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
57
To reference the Keysight VISA COM library in Microsoft Visual Basic 6.0:
1
Choose
Project > References...
from the main menu.
2
In the References dialog, check the "VISA COM 5.5 Type Library".
3
Click
OK
.
Opening the Oscilloscope Connection via the IO Library
PC controllers communicate with the oscilloscope by sending and receiving
messages over a remote interface. Once you have opened a connection to the
oscilloscope over the remote interface, programming instructions normally appear
as ASCII character strings embedded inside write statements of the programing
language. Read statements are used to read query responses from the
oscilloscope.
For example, when using the Keysight VISA COM library in Visual Basic (after
opening the connection to the instrument using the ResourceManager object's
Open method), the FormattedIO488 object's WriteString, WriteNumber, WriteList,
or WriteIEEEBlock methods are used for sending commands and queries. After a
query is sent, the response is read using the ReadString, ReadNumber, ReadList,
or ReadIEEEBlock methods.
The following Visual Basic statements open the connection and send a command
that turns on the oscilloscope's label display.
Dim myMgr As VisaComLib.ResourceManager
Dim myScope As VisaComLib.FormattedIO488
Set myMgr = New VisaComLib.ResourceManager
Set myScope = New VisaComLib.FormattedIO488
' Open the connection to the oscilloscope. Get the VISA Address from the
' Keysight Connection Expert (installed with Keysight IO Libraries Suite
).
Set myScope.IO = myMgr.Open("<VISA Address>")
' Send a command.
myScope.WriteString ":DISPlay:LABel ON"
The ":DISPLAY:LABEL ON" in the above example is called a
program message
.
Program messages are explained in more detail in
Initializing the Interface and the Oscilloscope
To make sure the bus and all appropriate interfaces are in a known state, begin
every program with an initialization statement. When using the Keysight VISA
COM library, you can use the resource session object's Clear method to clears the
interface buffer: