RIGOL DS1000B User Manual
Page 141

RIGOL
Programming Guide for DS1000B Series
3-9
5. Dblclick CH1 button to enter the programming environment, add the following
codes to achieve the control to it. (for CH2, CH3 and CH4, the methods 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 ' reserve to acquire the equipment ID.
' acquire USB resource of visa
Call viOpenDefaultRM(defrm)
Call viFindRsrc(defrm, "USB?*", list, nmatches, matches)
' open the equipment
Call viOpen(defrm, matches, 0, 0, vi)
' send the command to query the state of CH1
Call viVPrintf(vi, ":CHAN1:DISP?" + Chr$(10), 0)
' get the state of CH1
Call viVScanf(vi, "%t", strRes)
If strRes = 1 Then
' send the setting command
Call viVPrintf(vi, ":CHAN1:DISP 0" + Chr$(10), 0)
Label1(0).ForeColor = &H808080 ' gray
Else
Call viVPrintf(vi, ":CHAN1:DISP 1" + Chr$(10), 0)
Label1(0).ForeColor = &HFFFF& ' yellow
End If
' close the resource
Call viClose(vi)
Call viClose(defrm)
6. Save and run the project, you will get a single executable program about demo.
When the oscilloscope has been successfully connected with PC, you can
open/close each channel conveniently by clicking the button.