代码如下:
#include "C:\Program Files\IVI Foundation\VISA\WinNT\agvisa\include\visa.h"
#pragma comment(lib,"C:\\Program Files\\IVI Foundation\\VISA\\WinNT\\agvisa\\lib\\msc\\agvisa32.lib")
Char buf[255];
ViSession vi;
ViSession vi_FSP;
//打开频谱仪FSP7
viOpenDefaultRM(&vi);
if(VI_SUCCESS != viOpen(vi,GPIB0::28::INSTR, VI_NULL,VI_NULL, &vi_FSP)){
//仪器打开失败
Return;
}
viPrintf(vi_FSP,"*CLS\n");
viPrintf(vi_FSP,"SYST:DISP:UPDate ON\n");
viPrintf(vi_FSP,"SYST:PSAVE ON\n");
viPrintf(vi_FSP,"DISP:WIND:TRAC:Y:RLEV -10DBM\n");
viPrintf(vi_FSP,"DISP:TRAC:Y:RLEV:OFFS 0\n");
viPrintf(vi_FSP,"FREQ:SPAN 20MHZ\n");
viPrintf(vi_FSP,"FREQ:CENT 999MHZ\n");
viPrintf(vi_FSP, "BAND:VID:AUTO ON\n");//BAND:VID 300kHz
viPrintf(vi_FSP, "BAND:RES:AUTO ON\n");
viPrintf(vi_FSP,"SWE:TIME 1s\n");
viPrintf(vi_FSP,"INPUT:ATT 30dB\n");
viPrintf(vi_FSP,"BAND:RES 500KHz\n");//500
viPrintf(vi_FSP,"BAND:VID 500kHz\n");//10MHz
viPrintf(vi_FSP,"INIT;*WAI\n");
//----------------------------------
viPrintf(vi_FSP,"FREQ:CENT 999MHZ\n");
viPrintf(vi_FSP,"INIT:CONT OFF\n");
viPrintf(vi_FSP,"INIT:IMM;*WAI\n");
viPrintf(vi_FSP,"CALC:MARK:MAX\n");viClose(vi);
viQueryf(vi_FSP,"CALC:MARK:Y?\n","%t",buf);
viPrintf(vi_FSP,"INIT:CONT ON\n");
//-----------------------------------
Float f_max = atof(buf);
viClose(vi_FSP);
/////////////////////////////////////////////////////
Continuous vs. Single Sweep
In manual operation, the instrument typically performs measurements repeatedly, i.e. it operates in continuous sweep mode. This is useful for alignment tasks, where the instrument display immediately reflects adjustments performed on the device under test (DUT).
For remote control operations, however, continuous sweep presents several issues:
That’s to say,Only single sweep is suitable for remote control.
参考文档:第六章 远程控制-命令.pdf
FSP-K93.pdf
FSP_K90_e.pdf
FSP频谱仪第五章_远程控制-基础.pdf
第七章 远程控制程序举例.pdf
IEEE488[1].2.pdf
SCPI-99.pdf
The VISA Library.pdf