The following programs are provided without charge, for use entirely at your own risk.
HIOKI disclaims any and all responsibility for any consequences arising out of use of this software.
Visual Basic and Visual Studio are registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and other countries.
MS, Microsoft, Windows, MS-DOS, are registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and other countries.
This section describes an example of how to use the Windows development language Visual Basic2010 Express Edition to operate the IM3590 unit from a PC via RS-232C, incorporate measurement values, and save measurement values to a file. (When using RS-232C, the Z3001 RS-232C interface is additionally required.)
Visual Basic2010 is referred to as VB2010 hereafter.
Depending on the environment of the PC and VB2010, the procedure may differ slightly from the one described here. For a detailed explanation on how to use VB2010, refer to the instruction manual or Help of VB2010.Create a new project.
Startup VB2010.
Select [File] - [New Project] .
Select [Windows Forms Application] from the templates.
Click [OK].
Place a button.
Click [Button] from [Common Controls] of [Toolbox].
Drag and drop the button onto the form layout screen.
Change [Text] to "Start Measurement" from the Properties window.
The [Start Measurement] is placed on the form.
Place a serial communication component.
Click [SerialPort] from [Components] of [Toolbox].
Drag and drop the [SerialPort] component onto the form layout screen.
Change [PortName] to the port name to use for communication from the properties window.
Check the port to use for communication beforehand.
Describe the code.
Double-click the placed button to display the code editor.
Enter the sample program into the code editor.
Select [Save All] from the [File] menu.
Confirm the save location and then click [Save].
Set the interface of IM3590.
Set the interface settings of IM3590 as shown below.
Execute the program.
This sample program operates as shown below.
Click [Start Debugging].
Click [Start Measurement].
When measurement is finished, a message appears and the measurement values are saved in the \bin\Debug folder in which the project was saved.
Z,Phase,Cp,Lp 998.150E-03, -0.001, 2.430312E-09,-10.42265E+00 998.150E-03, -0.006, 16.80788E-09,-1.507049E+00 998.099E-03, -0.002, 4.951606E-09,-5.115571E+00 998.125E-03, -0.002, 4.458802E-09,-5.680965E+00 998.082E-03, -0.004, 12.12213E-09,-2.089591E+00 998.117E-03, -0.002, 5.055860E-09,-5.010087E+00 998.130E-03, -0.003, 9.168967E-09,-2.762612E+00 998.160E-03, -0.002, 5.503513E-09,-4.602568E+00 998.124E-03, -0.002, 6.831358E-09,-3.707945E+00 998.080E-03, -0.001, 3.565134E-09,-7.105004E+00
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Button1.Enabled = False ' Disables the button during measurement Try SerialPort1.NewLine = vbCrLf ' Sets the line feed code to CR+LF SerialPort1.Open() ' Opens serial communication port SerialPort1.WriteLine(":MODE LCR") ' Mode: LCR SerialPort1.WriteLine(":MEAS:ITEM 149,0") ' Measurement Parameter: Z,Phase,Cp,Lp SerialPort1.WriteLine(":HEAD OFF") ' Header: OFF SerialPort1.WriteLine(":LEV V") ' Signal level: Open-circuit voltage SerialPort1.WriteLine(":LEV:VOLT 0.5") ' Signal level: 500 mV signal level SerialPort1.WriteLine(":FREQ 1E3") ' Measurement frequency: 1kHz SerialPort1.WriteLine("TRIG EXT") ' Trigger: External trigger Dim dt As DateTime = DateTime.Now ' Acquires date and time Dim filename As String = dt.ToString("yyyy-MM-dd_HH-mm-ss") + ".csv" ' Sets the file name Dim rd As String Dim fp As New System.IO.StreamWriter(filename, False, _ System.Text.Encoding.GetEncoding("shift_jis")) ' File open fp.Write("Z,Phase,Cp,Lp" + vbCrLf) ' Outputs the header to file For index As Integer = 1 To 10 ' Repeats measurement 10 times SerialPort1.WriteLine("*TRG;:MEAS?") ' Reads trigger and measurement results rd = SerialPort1.ReadLine ' Acquires measurement results fp.Write(rd) ' Outputs the measurement results to file fp.Write(vbCrLf) ' Outputs the line feed to file Next fp.Close() ' Closes file SerialPort1.Close() ' Closes serial communication port MsgBox("End of measuremen") ' Displays measurement finished messag Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try Button1.Enabled = True ' Enables the button End Sub End Class