RIGOL DP832A User Manual

Page 200

Advertising
background image

RIGOL

Chapter 4 Programming Demos

4-12

DP800 Programming Guide

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, ":OUTP? CH1" + Chr$(10), 0)

' Acquire the status of CH1

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

If strRes = "ON" Then

' Send the setting command

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

Label1(0).ForeColor = &H808080 'Gray

Else

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

Label1(0).ForeColor = &HFFFF& 'Yellow

End If

' Turn off the resource

Call viClose(vi)

Call viClose(defrm)

6

Running results

1) Click CH1 to enable CH1 and the control above CH1 turns yellow;

2) Click CH2 to enable CH2 and the control above CH2 turns blue;

3) Click CH3 to enable CH3 and the control above CH3 turns rosy.

The running results are as shown in the figure below.

Advertising
This manual is related to the following products: