Specifications
Chapter 4 Programming Demos RIGOL
M300 Programming Guide 4-15
C++ Programming Demo
The program used in this Demo: Microsoft Visual Studio 2008
The functions realized in this Demo: search for the instrument address, connect the instrument, send
command and read the return value.
1 Run Microsoft Visual Studio 2008, create a MFC project based on dialog box and name it as
M300_Demo_VC.
2 Add a visa library by adding the statement as follows to the M300_Demo_VCDlg.cpp file.
#pragma comment (lib,"C:\Program Files\IVI Foundation\VISA\WinNT\lib\msc ")
Note:
The path added here is related to the NI-VISA installation path on your PC. Here, the NI-VISA is
installed under C:\Program Files\IVI Foundation\VISA.
3 Add the Text, Edit, Button, Radio Button, Combo Box and Group Box controls and the layout is
as shown in the figure below.
4 Click ProjectAdd variable and add the Edit, Radio Button and Combo Box control variables in
the pop-up interface. The explanations of the variables are as shown in the table below.
Control
Variable Type
Variable Name
Explanation
edtM300INfo
CString
strM300Info
M300 Information
edtSendCommand
CString
strSendCommand
Command
edtReadFromM300
CString
strReadFromM300
Return value
edtChannel
CString
strChannel
Channel Number
rbtnDCV
CButton
m_ctrlrbtnDCV
DCV measurement
rbtnDCI
CButton
m_ctrlrbtnDCI
DCI measurement
rbtnACV
CButton
m_ctrlrbtnACV
ACV measurement
rbtnACI
CButton
m_ctrlrbtnACI
ACI measurement
rbtn2WR
CButton
m_ctrlrbtn2WR
2WR measurement
rbtn4WR
CButton
m_ctrlrbtn4WR
4WR measurement
rbtnFrequency
CButton
m_ctrlrbtnFrequency
Frequency measurement
rbtnPeriod
CButton
m_ctrlrbtnPeriod
Period measurement
rbtnTemperature
CButton
m_ctrlrbtnTemperature
Temperature measurement