Tutorial
KIKUSUI Electronics Corp.
PWR-01 Interface Manual
When using the alias for the I/O resource, even if the alias name is hard-coded
directly in the application, the alias name can be easily converted to the appropriate
I/O resource name.
Example : When using the alias (MYDEV1) for the I/O resource.
Set msg = rm.Open("MYDEV1", NO_LOCK, 0, "")
When the alias is used, the actual I/O resource is specified by an external configu-
ration table.
Please refer to the applicable VISA manual.
Controlling the devices
Next, use "Read" and "Write" commands to control devices. You must include line-
feed codes in the command strings.
Example:
msg.WriteString ("VOLT 10" & vbLF) 'Set the voltage to 10 V
msg.WriteString ("OUTP 1" & vbLF) 'Turn the output on
Closing the VISA
Close the VISA at the end.
You only need to include one "open" VISA command and one "close" VISA com-
mand in the program.
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"
)
msg = rm.Open(
"USB0::0x0B3E::0x1049::00000001::INSTR"
,
AccessMode
.NO_LOCK, 0,
""
)
'Example: Using an VISA alias
'msg = rm.Open("MYDEV1", AccessMode.NO_LOCK, 0, "")
'Example: LAN(SCPI-RAW)
'msg = rm.Open("TCPIP::169.254.7.8::5025::SOCKET", AccessMode.NO_LOCK, 0, "")
msg.TerminationCharacterEnabled =
True
End Sub
'Query the instrument identity
Private Sub
Button1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System
.
EventArgs
)
Handles
Button1.Click
msg.WriteString(
"SYST:COMM:RLST?"
& vbLf)
msg.WriteString(
"*IDN?"
& vbLf)
TextBox1.Text = msg.ReadString(256)
End Sub
'Set the voltage and current
Private Sub
Button2_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System
.
EventArgs
)
Handles
Button2.Click
msg.WriteString(
"OUTP 0"
& vbLf)
msg.WriteString(
"VOLT 8"
& vbLf)
msg.WriteString(
"CURR 5"
& vbLf)
msg.WriteString(
"OUTP 1"
& vbLf)
End Sub
'Querys measurement voltage
Private Sub
Button3_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System
.
EventArgs
)
Handles
Button3.Click
msg.WriteString(
"MEAS:VOLT?"
& vbLf)
TextBox1.Text = msg.ReadString(256)
End Sub
Private Sub
Form1_Disposed(
ByVal
sender
As Object
,
ByVal
e
As
System
.
EventArgs
)
Handles
Me.Disposed
msg.Close()
End Sub
End Class