7352 Series Digital Multimeter Operation Manual
6.7.4 Sample Programs (USB)
6-62
6.7.4
Sample Programs (USB)
This section describes example programs in which a computer controls this instrument through a USB
interface.
[Operation check environment]
Computer:
DELL OPTIPLEX 170L(Pentium
4 CPU 2.80GHz)
Module:
asub.bas (Software included in the USB driver for the ADC CORPO-
RATION’s instrument)
Language:
Microsoft Excel Visual Basic for Application
NOTE:
The USB ID of the 7352A/E is set to 1.
Example 1 Sets the DCV-Ach 20 V range for the left side display and performs the measurement in the
free run state. Reads the measured data from the 7352A/E and displays the data in cells.
Dim DMM As Long
'USB handle
Private Const OK As Integer = 0
'Definition of OK
Private Sub Com_usb_sample1_Click()
'Sample 1
Dim myID As Long
'Declares the USB ID variable of the 7352A/E.
Dim rstr As String
'Declares the variable of the buffer used for receiving the USB data.
Dim ret As Long
'Declares the variable of the driver return value.
myID = 1
'Sets USB ID to 1.
ret = ausb_start(10)
'USB initialization, time-out: 10 seconds
If ret <> OK Then
'If the USB initialization is performed incorrectly,
MsgBox "USB initialization error", vbExclamation
GoTo err_exit
End If
Call mSecSleep(100)
'Waits for the USB initialization (100 ms).
ret = ausb_open(DMM, myID)
'Opens the DMM whose MyID is set to 1 and acquires the USB han-
dle.
If ret <> OK Then
'If the device is opened incorrectly,
MsgBox "device OPEN error", vbExclamation
GoTo err_exit
End If
Call ausbwrt(DMM, "*RST")
'Initializes the instrument.
Call ausbwrt(DMM, "H1")
'Sets the header of the output data to ON.
Call ausbwrt(DMM, "DE0")
'Sets the right side display to OFF.
Call ausbwrt(DMM, "DSP1,F1")
'Sets the measurement function for the left side display to DCV.
Call ausbwrt(DMM, "DSP1,R5"
'Sets the measurement range for the left side display to 20 V.
Call ausbwrt(DMM, "PR4")
'Sets the sampling rate to SLOW2.
Call ausbrd(DMM, rstr)
'Reads the measured data.
Cells(1, 1) = "'" & rstr
'Substitutes the measured value for a cell.
err_exit:
ret = ausb_close(DMM)
'Closes the device.