If you are using a VISA implementation other than KI-VISA, 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 character strings.
Example:
msg.WriteString ("VOLT 110" & vbLF) 'Set the AC voltage to 110 V
msg.WriteString ("FREQ 60" & vbLF) 'Set the frequency to 60.0 Hz
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 command in the
program.
msg.Close
Sample program
Imports
Ivi.Visa.Interop
Public Class
Form1
Dim
rm
As
ResourceManager
Dim
msg
As
IMessage
Private Sub
Form1_Load(
ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles MyBase
.Load
rm = CreateObject(
"VISA.GlobalRM"
)
msg = rm.Open(
"GPIB0::1::INSTR"
, AccessMode.NO_LOCK, 0, "")
'Example: How to write GPIB
'msg = rm.Open(
"MYDEV1"
, AccessMode.NO_LOCK, 0, "")
'Example: Using an alias
'msg = rm.Open(
"USB0::0x0B3E::0x1024::00000001::INSTR"
, AccessMode.NO_LOCK, 0, "")
'Example: USB
'msg = rm.Open(
"TCPIP::169.254.178.141::INSTR"
, AccessMode.NO_LOCK, 0, "")
'Example: LAN
msg.TerminationCharacterEnabled = True
End Sub
'Query the instrument identity
Private Sub
cmdIdn_Click(
ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
cmdIdn.Click
msg.WriteString(
"*IDN?"
& vbLF)
TextBox1.Text = msg.ReadString(256)
End Sub
'Set the voltage and frequency
Private Sub
cmdCurr_Click(
ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
cmdCurr.Click
msg.WriteString(
"OUTP 0"
& vbLF)
msg.WriteString(
"VOLT 110"
& vbLF)
msg.WriteString(
"FREQ 60"
& vbLF)
msg.WriteString(
"OUTP 1"
& vbLF)
End Sub
'Querys measurement DC voltage
Private Sub
cmdMeas_Click(
ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
cmdMeas.Click
msg.WriteString(
"MEAS:VOLT:DC?"
& 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
PCR-M series Communication Interface Manual
KIKUSUI ELECTRONICS CORP.
71/166