RIGOL DG1000Z Series User Manual

Page 241

Advertising
background image

Chapter 4 Programming Demos

RIGOL

DG1000Z Programming Guide

4-15

4

Open the “General” tab in Project  Project1 Properties and select “Form1” in the “Startup Object”

dropdown box.

5

Double-click the CH1 button to enter the programming environment. Add the following codes to

control CH1 and CH2. The codes of CH1 are as shown below; the codes of CH2 are similar.

Dim defrm As Long

Dim vi As Long

Dim strRes As String * 200

Dim list As Long

Dim nmatches As Long

Dim matches As String * 200

' Acquire the usb resource of visa

Call viOpenDefaultRM(defrm)

Call viFindRsrc(defrm, "USB?*", list, nmatches, matches)

' Turn on the device

Call viOpen(defrm, matches, 0, 0, vi)

' Send command to query the CH1 status

Call viVPrintf(vi, ":OUTP1?" + Chr$(10), 0)

' Acquire the status of CH1

Call viVScanf(vi, "%t", strRes)

If strRes = "ON" Then

' Send the setting command

Call viVPrintf(vi, ":OUTP1 OFF" + Chr$(10), 0)

Label1(0).ForeColor = &H808080 'Gray

Else

Call viVPrintf(vi, ":OUTP1 ON" + Chr$(10), 0)

Advertising