Call viFindRsrc(defrm, "USB?*", list, nmatches, matches)
' Turn on the instrument
Call viOpen(defrm, matches, 0, 0, vi)
' Send a command to query the status of CH1
Call viVPrintf(vi, ":CHAN1:DISP?" + Chr$(10), 0)
' Obtain the status of CH1
Call viVScanf(vi, "%t", strRes)
s32Disp = CInt(strRes)
If (s32Disp = 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. Results
a. Click CH1 to turn on CH1 and the label above CH1 turns yellow;
b. Click CH2 to turn on CH2 and the label above CH2 turns blue;
c. Click CH3 to turn on CH3 and the label above CH3 turns rosy.
The results are as shown in the figure below.
5.4
+ Programming Example
Program used in this example:Visual C++6.0
Function realized in this example:search for the instrument address, connect to the
instrument, send commands, and read return values.
Enter the Visual C++6.0 programming environment, and perform the following
procedures.
1. Create a MFC project based on a dialog box.
2. Click Project > Settings to open the Project Setting dialog box. In the dialog box,
click the C/C++ tab, select Code Generation from the drop-down list under
Programming Examples
128
Copyright ©RIGOL TECHNOLOGIES CO., LTD. All rights reserved.
Содержание DP900 Series
Страница 1: ......
Страница 133: ...d Exit Programming Examples Copyright RIGOL TECHNOLOGIES CO LTD All rights reserved 125 ...
Страница 141: ......