115
Sample Programs
Using the DM7276 to perform scan measurement
Connect the SW1001 and DM7276 to their respective COM ports and perform scan measurement
from CH1 to CH22 for
SLOT 1
.
The USB interface can be used to communicate with the device in the same manner as the RS-
232C interface. Check the COM number for the USB connection in the device properties and use
that number for communications. Communications speed has no meaning in the context of a USB
connection.
Imports System.IO.Ports
'Scan measurement sample
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sp1 As SerialPort
Dim sp2 As SerialPort
Dim writer1 As IO.StreamWriter
Dim unit_no As Integer
Dim ch_no As Integer
Dim ch_str As String
Dim recv_str As String
'Connect the SW1001 to COM3.
sp1 = New System.IO.Ports.SerialPort("COM3", 9600, Parity.None, 8, StopBits.One)
sp1.NewLine = vbCrLf : sp1.ReadTimeout = 1000
'Connect the DM7276 to COM4.
sp2 = New System.IO.Ports.SerialPort("COM4", 9600, Parity.None, 8, StopBits.One)
sp2.NewLine = vbCrLf : sp2.ReadTimeout = 1000
sp1.Open()
sp2.Open()
sp1.DiscardInBuffer()
sp2.DiscardInBuffer()
'Open a file for saving.
writer1 = New IO.StreamWriter(Application.Start "\data.csv")
'Configure SLOT1 as a 2-wire connection.
sp1.WriteLine(":SYST:MOD:WIRE:MODE 1,WIRE2")
sp1.WriteLine("*OPC?")
sp1.ReadLine()
For unit_no = 1 To 1
For ch_no = 1 To 22
'Create a string to specify the channel.
ch_str = Format(unit_no, "00") + Format(ch_no, "00")
'Close the specified channel and wait for the operation to complete.
sp1.WriteLine(":CLOS " + ch_str)
sp1.WriteLine("*OPC?")
sp1.ReadLine()
'Send the one-time measurement command to the DM7276 and receive the measured value.
sp2.WriteLine(":READ?")
recv_str = sp2.ReadLine()
'Write measurement data to a file.
writer1.WriteLine( "," + recv_str)
Next
Next
8
Communication Function
HIOKI SW1001A961-04
Summary of Contents for SW9001
Page 2: ...HIOKI SW1001A961 04...
Page 42: ...38 Channel Delay Function HIOKI SW1001A961 04...
Page 48: ...44 Scan Measurement Example HIOKI SW1001A961 04...
Page 50: ...46 Checking the Device Status HIOKI SW1001A961 04...
Page 52: ...48 Initialization Settings HIOKI SW1001A961 04...
Page 118: ...114 Sample Programs 3 Select FILE Save All HIOKI SW1001A961 04...
Page 160: ...156 Outline Drawings 12 4 Outline Drawings SW1001 Unit mm Tolerance 0 2 HIOKI SW1001A961 04...
Page 161: ...157 Outline Drawings SW1002 Unit mm Tolerance 0 2 12 Appendix HIOKI SW1001A961 04...
Page 162: ...158 Outline Drawings HIOKI SW1001A961 04...
Page 164: ...160 HIOKI SW1001A961 04...
Page 167: ...HIOKI SW1001A961 04...
Page 168: ...HIOKI SW1001A961 04...
Page 169: ...HIOKI SW1001A961 04...