Visual Basic 2005 Sample Program
Sample program of setting and queries (USB) 'Create VISA ResourceManager object Dim rm As New Ivi.Visa.Interop.ResourceManager Dim accessMode As Ivi.Visa.Interop.AccessMode = Ivi.Visa.Interop.AccessMode.NO_LOCK 'Serial number of the multifunction generator Dim serial As String = "0123456" Dim timeOut As Integer = 0 Dim optionString As String = "" 'Connect with the device(USB) Dim msg As Ivi.Visa.Interop.IMessage = CType( _ rm.Open("USB0::0x0D4A:0x000F::" & serial & "::INSTR", _ accessMode, _ timeOut, _ optionString), _ Ivi.Visa.Interop.IMessage) 'Set the frequncy as 5.0 kHz, and ask the value msg.WriteString(":FREQ 5000;:FREQ?" & vbLf) Console.WriteLine(msg.ReadString(256)) 'Close the device msg.Close()
Sample program of setting and queries (GPIB) 'Create VISA ResourceManager object Dim rm As Ivi.Visa.Interop.ResourceManager = New Ivi.Visa.Interop.ResourceManager Dim accessMode As Ivi.Visa.Interop.AccessMode = Ivi.Visa.Interop.AccessMode.NO_LOCK Dim timeOut As Integer = 0 Dim optionString As String = "" 'Connect with the device(GPIB address:2) Dim msg As Ivi.Visa.Interop.IMessage = CType( _ rm.Open("GPIB0::2::INSTR", _ accessMode, _ timeOut, _ optionString), _ Ivi.Visa.Interop.IMessage) 'Set the Offset as 0.0V, Amplitude as 20.0Vp-p and Output as on, 'and ask the value msg.WriteString(":SOUR1:VOLT:OFFS 0V;:SOUR1:VOLT 20VPP;OUTP1 1;:SOUR1:VOLT?" & vbLf) Console.WriteLine(msg.ReadString(256)) 'Close the device msg.Close()