
TOS5300_INTERFACE
73
Using Visual Basic 2008
App
■
Opening VISA
Before you can use the VISA library to communicate with the USB feature, you have to open VISA.
Specify an I/O resource to open VISA.
Example: Opening VISA to communicate over USB
Set rm = CreateObject("VISA.GlobalRM")
Set msg = rm.Open("USB::0x0B3E::0x1017::00000001::INSTR", NO_LOCK, 0, "")
“USB::0x0B3E::0x1017::00000001::INSTR” is an I/O resource.
The I/O resource syntax is shown below. The parts surrounded by square brackets ([ ]) can be
omitted. Enter the appropriate values in the parts written in italics.
USB[
board]
::VendorID::ProductID::
SerialNumber[::InterfaceNumber]
[::INSTR]
Example: A USNTMC measuring instrument whose vendor ID (VID) is 0x0B3E, product ID (PID) is
0x1017, and serial number is 00000001
USB0::0x0B3E::0x1017::00000001::INSTR
In VISA, you can use aliases for I/O resources.
If you use an alias for an I/O resource, even if the alias name is hard-coded in the application, the I/O
resource name can still be changed to an appropriate value when the application runs.
Example: Using an alias (MYDEV1) for an I/O resource
Set msg = rm.Open("MYDEV1", NO_LOCK, 0, "")
When you use aliases, specify the actual I/O resources through an external configuration table or
similar tool. The following figure shows an example of using KI-VISA with the USB interface.
If you are using a version of VISA other than KI-VISA, see the manual of your VISA version.
■
Controlling the instrument
Next, we will use commands such as read and write commands to control the instrument.
Example:
msg.WriteString ("SOUR:VOLT 1.5KV")
'Sets the test voltage to 1.5 kV
msg.WriteString ("SOUR:VOLT:PROT 2KV")
'Sets the limit voltage to 2 kV
msg.WriteString ("SENS:JUDG 10MA")
'Sets the upper limit for
judgments to 10 mA
■
Closing VISA
Finally, close VISA.
In a sequence of operations, you only have to open and close VISA once.
msg.Close
1. Select the I/O resource that you want to use.
2. Enter the alias name.
MYDEV1