EasyManuals Logo

Rigol DL3000 Series Programming Guide

Rigol DL3000 Series
96 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #79 background imageLoading...
Page #79 background image
Chapter 4 Programming Instances RIGOL
DL3000 Programming Guide 4-5
5. Click View Code under Developer menu to enter the interface of Microsoft Visual Basic. Add the
following codes and save the file.
Note: If the Excel file created at Step 2 does not enable the Macros, a prompt message "The following
features cannot be saved in macro-free workbooks" will be displayed. In this case, please save the file
as a macro-enabled file type (filename with a suffix of ".xlsm").
Sub QueryIdn()
Dim viDefRm As Long
Dim viDevice As Long
Dim viErr As Long
Dim cmdStr As String
Dim idnStr As String * 128
Dim ret As Long
'Turn on the device, and the device resource descriptor is in CELLS(1,2) of SHEET1'
viErr = visa.viOpenDefaultRM(viDefRm)
viErr = visa.viOpen(viDefRm, Sheet1.Cells(1, 2), 0, 5000, viDevice)
‘Send request, read the data, and the return value is in CELLS(2,2) of SHEET1’
cmdStr = "*IDN?"
viErr = visa.viWrite(viDevice, cmdStr, Len(cmdStr), ret)
viErr = visa.viRead(viDevice, idnStr, 128, ret)
Sheet1.Cells(2, 2) = idnStr
‘Turn off the device’
visa.viClose (viDevice)
visa.viClose (viDefRm)
End Sub
6. Add the button control, and click "Insert" under the Developer menu. Select a button control under the
"Form Control" menu item and put it into the Excel cell. At this time, the Assign Macro dialog box is
displayed, select "Sheet1.QueryIdn" and click OK.
The default name of the button is "Button1". Right-click the button and select Edit Text in the pop-up
menu to change the button name to "*IDN?".
7. Click *IDN? to run the program. The return value is displayed in CELLS(2,2) of SHEET1.

Table of Contents

Other manuals for Rigol DL3000 Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Rigol DL3000 Series and is the answer not in the manual?

Rigol DL3000 Series Specifications

General IconGeneral
BrandRigol
ModelDL3000 Series
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals