7352 Series Digital Multimeter Operation Manual
6.7 Sample Programs
6-52
6.7
Sample Programs
6.7.1
Sample Programs (GPIB commands used in ADC CORPORATION)
This section describes example programs in which a computer controls this instrument through a GPIB
interface.
[Operation check environment]
Computer:
DELL OPTIPLEX GX170L(Pentium
4 CPU 2.80GHz)
GPIB hardware:
GPIB-USB-HS manufactured by NATIONAL INSTRUMENTS
Module:
Niglobal.bas,Vbib-32.bas (Included software in PCI-GPIB)
Language:
Microsoft Excel Visual Basic for Application
NOTE:
The GPIB address of the 7352A is set to 1.
Example 1 Sets the DCV-Ach 2 V range for the left side display and the ACV-Ach 2 V range for the right
side display, and then performs the measurement in the free run state. Detects the measure-
ment end by polling the status byte, reads the measured data from the 7352A, and then dis-
plays the data in cells.
Dim DMM_ADR As Integer
'Declares the GPIB address variable of the 7352A.
Dim dmm As Integer
'Declares the variable of the device descriptor.
Dim dt As String * 100
'Declares the variable of the buffer used for receiving the GPIB data.
DMM_ADR = 1
'GPIB address of the 7352A
Call ibdev(0, DMM_ADR, 0, T10s, 1, 0, dmm)
'Initializes the GPIB I/F.
Call ibconfig(dmm, IbcUnAddr, 1)
'Sets the transmitting and receiving addresses individually.
Call ibwrt(dmm, "*RST" & vbLf)
'Initializes the 7352A.
Call ibwrt(dmm, "H1" & vbLf)
'Sets the header of the output data to ON.
Call ibwrt(dmm, "DSP1,F1" & vbLf)
'Sets the measurement function for the left side display to DCV.
Call ibwrt(dmm, "DSP1,R4" & vbLf)
'Sets the measurement range for the left side display to 2 V.
Call ibwrt(dmm, "DSP2,F2" & vbLf)
'Sets the measurement function for the right side display to ACV.
Call ibwrt(dmm, "DSP2,R4" & vbLf)
'Sets the measurement range for the right side display to 2 V.
Call ibwrt(dmm, "PR2" & vbLf)
'Sets the sampling rate to MED.
Call ibwrt(dmm, "*CLS" & vbLf)
'Clears the status byte.
Do
'Reads the status byte of the measurement end.
Call ibwrt(dmm, "*STB?" & vbLf)
'Requests the content of the status byte.
Call ibrd(dmm, dt)
'Writes the content of the status byte into the variable dt.
dt = dt And 16
'Performs the AND operation in bit4 (MAV).
Loop While (dt <> 16)
Call ibwrt(dmm, "SD1" & vbLf)
'Sets the output data to the left side display.
Call ibrd(dmm, dt)
'Reads the measured data on the left side display.
Cells(1, 1) = "'" & Left(dt, 18)
'Substitutes the measured value on the left side display for a cell.