Using MFC to write software to control Agilent signal source based on VS2010

Programmable signal source

I recently contacted about writing "Automated Test Software", which was used in it, and it needs to realize the program control of the spectrum analyzer and signal source. Therefore, I will make a summary and think about the problems encountered every day and the knowledge learned.
Signal source program control realization: The
signal source model is E44XXC, the specific ideas:
<1>When program control must be clearly realized, VISA library and SCPI commands are required; about SCPI commands, you must check the user book or programming manual of the corresponding instrument, from keysight The official website can download the corresponding manual.
<2>When connecting to the device, take the network port connection as an example. How to query the IP address of the corresponding device? After connecting to the keysight connection expert, the corresponding software interface can display the device model and the corresponding IP address. At this time, set the computer's IP address to be in the same network segment as the instrument IP.
<3> In the programming stage, call the function in the VISA library, and then search from the programming manual of the corresponding instrument. The corresponding SCPI instruction can be programmed to the signal source by issuing instructions to the signal source through the upper computer software written by yourself. .

The interface is shown in the figure below:
Insert picture description here

Requirements:
Because the requirements mentioned only need to control the signal source: frequency change, intensity change (the range of intensity is equal to 20dBm), and RF switch, so only these functions need to be met, which is relatively simple.
Programming:
The corresponding SCPI commands used are as follows:
Frequency:

// 频率部分 对应的SCPI指令 :FREQ 900MHZ
CString com1,com2,s;
com1=m_centerfreq;
com2=m_centerfreqM;
s=":FREQ ";
viprintf(m_ViSession,s + com1 + "GHZ\n");
viprintf(m_ViSession,s + com1 + "GHZ\n");

strength:

// 强度部分 对应的SCPI指令 :POWer:AMPLitude -125dBm
CSting com,s;
s=":POWer:AMPLitude ";
viprintf(m_ViSession,s + com + "DBM\n");

RF switch:

viprintf(m_ViSession,":OUTPut:STATe OFF\n");
viprintf(m_ViSession,":OUTPut:STATe ON\n");

Regarding the connection of the signal source, I wrote it directly in the picture above, because that part of the code is on another computer and I am too lazy to type it manually.
Insert picture description here

The above is the compilation of the control software of the signal source, which has been debugged and can fully control the signal source.
Hope it is useful to others.

Guess you like

Origin blog.csdn.net/qq_27538633/article/details/106365986