Tutorial
PCR-WE Interface Manual
339
FQDN). If you are using an mDNS hostname, Apple Bonjour (alternatively, iTunes or Safari)
must be installed on your PC.
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 configu-
ration table or similar tool. Refer to the VISA manual.
Controlling the instrument
Next, we will use commands such as read and write commands to control the instru-
ment. You must include line-feed codes in the command strings.
Examples:
msg.WriteString ("VOLT 110" & vbLF)
'Sets the AC voltage to 110 V
msg.WriteString ("FREQ 60" & vbLF)
'Sets the frequency to 60.0 Hz
msg.WriteString ("OUTP 1" & vbLF)
'Turns the output on
Closing VISA
Finally, close VISA.
In a sequence of operations, you only have to open and close VISA once.
msg.Close
■
Sample program
Imports
Ivi.Visa.Interop
Public Class
Form1
Dim
rm
As
ResourceManager
Dim
msg
As
IMessage
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System
.
EventArgs
)
Handles MyBase
.Load
rm = CreateObject(
"VISA.GlobalRM"
)