RIGOL DS1000D User Manual
Page 126
RIGOL
Programming Guide for DS1000E, DS1000D Series
3-22
4. Choose Project→Project1 Properties→General, select “Form1” from the
drop down box of Startup Object.
5. Dblclick CH1 button to enter the programming environment, add the following
codes to achieve the control to it. (for CH2, the method is 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 Left(strRes, 2) = "ON" 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)