Anjet's instruments are the most used in the laboratory, including spectrum analyzers, signal sources, network analyzers, and signal analyzers. Anjet itself provides a secondary development interface for the instrument to allow the computer to control various instruments and read data. It mainly sends SCPI commands to the instrument through the computer, the interface for sending commands is Virtual Instrument Software Architecture)
Procedures for using visa to control instruments
Compared with other existing I/O interface software, visa has the following features:
1. Visa's I/O control function is suitable for various types of instruments. Visa includes the control operations of VXI instruments, Gui instruments, RS232 serial interface instruments, and other instruments, it also includes operations on message-based devices, register-based devices, storage devices, and other instruments, which are unified in form.
2. Visa's I/O control function is applicable to various types of hardware interfaces. Take the VXI instrument system as an example, regardless of the embedded computer structure, the external hanging structure of the GUI interface, and the external hanging structure of the mxi interface, the external mounting structure of the ieee1394 interface is used, and the operation functions of the VXI instrument are the same. Likewise, no matter what the logic address of the VXI instrument in the system is, the instrument operation functions are the same.
3. Visa's I/O control function is applicable to the single-processor system structure and multi-processor or distributed network structure.
4. Visa's I/O control function is applicable to a variety of network mechanisms. no matter whether the virtual instrument system network is a VXI multi-Chassis extended network or Ethernet, the operation of the instrument is consistent.
5. the source code of the I/O software library of visa is unique, and it has nothing to do with the operating system and programming language. It only provides different forms of API files as the introduction of the system.
Because the visa structure takes into account compatibility between various instrument types and network mechanisms, the virtual instrument system based on the visa I/O interface software, not only can it be combined with existing instrument systems (such as the GUI Instrument System and the serial interface Instrument System), but also can completely transition the Instrument System from the centralized structure of the past to the distributed structure. The compatibility and interoperability of visa ensure that new-generation instruments can be added to the virtual instruments system, at the same time, it also ensures that investors of the instrument system will not abandon the past system because of the emergence of new instruments, so as not to waste investment. During system integration, you do not have to select a special software or hardware product. You can make the best choice among all VPP products according to your own needs, the compatibility and robustness of the system are greatly enhanced, and the standardization and uniformity of the system have also been the most fundamental guarantee.
The code for a typical visa-controlled analyzer is as follows:
# Include <visa. h>
# Include <stdio. h>
Void main (){
Visessiondefaultrm, VI;
Char Buf [256] = {0 };
/* Open sessionto GPIB device at address 2
Viopendefaultrm (& defaultrm );
Viopen (defaultrm,
"Gpib0: 22: instr", vi_null, vi_null, & VI );
/* Initializedevice */
Viprintf (Vi, "* rst \ n ");
/* Send an * IDN? String to the device */
Viprintf (Vi, "* IDN? \ N ");
/* Read results */
Viscanf (Vi, "% t", Buf );
/* Print results */
Printf ("instrumentidentification string:
% S \ n ", Buf );
/* Close session */
Viclose (VI );
Viclose (defaultrm );}
The frequency spectrometer involves the control center frequency (CF), bandwidth (SPAN), scan point (sweeppoints), vbw, rbw, scan time (sweeptime), and reference level (REF. The command is written as follows:
Cf |
Set the center frequency to 950.5 MHz |
": Freq: cent 950.5 E6 \ n" |
Span |
Set bandwidth to 950.5 MHz |
": Freq: Span 950.5 E6 \ n" |
Rbw |
Set rbw3khz |
": Bwid: res 3e3 \ n" |
Vbw |
Set vbw100hz |
": Bwid: vid 100 \ n" |
Swtime |
Set the scan time to 100 s |
": Swe: Time 100 \ n" |
Points |
Set scan points 401 |
": Swe: poin 401 \ n" |
Ref |
Set Reference Level-80dbm |
": Disp: Wind: TRAC: Y: rlev-80 \ n" |
Scale |
Set scale5 dBm |
": Disp: Wind: TRAC: Y: pdiv-5 \ n" |
Freq |
Set the transmission frequency to 15 GHz. |
": Freq: Fix 15 GHz \ n |
TP |
Set transmit power to 10 |
: Pow 10dBm \ n |