代码如下:
#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_SMIQ;
//打开SMIQ
viOpenDefaultRM(&vi);
if(VI_SUCCESS != viOpen(vi,GPIB0::28::INSTR, VI_NULL,VI_NULL, &vi_SMIQ)){
//仪器打开失败
Return;
}
viPrintf(vi_SMIQ,"*CLS\n");
viPrintf(vi_SMIQ,"FREQ 1000MHZ\n");
viPrintf(vi_SMIQ,"POW -50dBm\n");//cal:0
#ifdef N5182B
viPrintf(vi_SMIQ, ":OUTP:STAT OFF\n");//RF ON
viPrintf(vi_SMIQ, ":OUTP:MOD:STAT OFF\n");//MOD ON
viPrintf(vi_SMIQ, ":DM:SOURce EXTernal\n");//Internal
viPrintf(vi_SMIQ, ":DM:IQ:STATE OFF\n");
//viPrintf(vi_SMIQ, ":DM:EXTernal:FILTer 40e6\n");
//viPrintf(vi_SMIQ, ":DM:MODulation:FILTer THR\n");//2.1e6 40e6
//viPrintf(vi_SMIQ, ":DM:MODulation:ATTen:AUTO\n");
//viPrintf(vi_SMIQ, ":DM:MODulation:FILTer:AUTO\n");
//viPrintf(vi_SMIQ, "DM:EXTernal:FILTer:AUTO\n");
//viPrintf(vi_SMIQ, ":DM:EXTernal:FILTer THRough\n");//40e6|THRough
//viPrintf(vi_SMIQ, ":DM:IQADjustment ON\n");
#else
viPrintf(vi_SMIQ,"OUTP:STAT ON\n");//RF ON smiq
viPrintf(vi_SMIQ,"MOD:STATE OFF\n");
#endif//*/
#ifdef N5182B
viPrintf(vi_SMIQ, ":DM:IQ:STATE OFF\n");//IQ OFF
viPrintf(vi_SMIQ, ":OUTP ON\n");//RF ON
viPrintf(vi_SMIQ, "MOD:STATE OFF\n");//MOD OFF
#else//SMIQ
viPrintf(vi_SMIQ,"DM:IQ:STATE OFF\n");//IQ OFF
viPrintf(vi_SMIQ,"OUTP:STAT ON\n");//RF ON
viPrintf(vi_SMIQ,"MOD:STATE OFF\n");//MOD OFF
#endif
viPrintf(vi_SMIQ,":SYST:COMM:GTL\n");
#ifdef N5182B
viPrintf(vi_SMIQ,":DM:SOURce EXTernal\n");
viPrintf(vi_SMIQ,":DM:STATE ON\n");//IQ ON
viPrintf(vi_SMIQ, ":OUTP ON\n");//RF ON
viPrintf(vi_SMIQ, ":OUTP:MOD ON\n");//MOD ON
viPrintf(vi_SMIQ,":POW:ALC 1\n");
viPrintf(vi_SMIQ,":POW:ALC:SEAR 1\n");//MANUAL
#else
viPrintf(vi_SMIQ,"DM:IQ:STATE ON\n");
#endif
viClose(vi_SMIQ);