通过Visa库函数控制不同仪表(信号源、频谱仪和功率计)方法小结

信号源? 
//信号源设置较少,主要设置频率和功率。?
viPrintf(vi_sig,?"FREQ?999MHz\n");?
viPrintf(vi_sig,?"POW??0dBm\n");? 
viPrintf(vi_sig,?"OUTP?ON\n");?//射频开


viPrintf(vi_sig,?"MOD??ON\n");?//调制开?其他滤波器什么的,很少用。? 
最新的仪器有有个很强大的功能,按下某个键即可显示其相应的SCPI命令,?于此我们不用查编程文档了,真是爽歪歪。?
viPrintf(vi_sig,"DM:IQ:STATE?ON\n");? 
//?viPrintf(vi_4438c,?"OUTP:MOD:STAT?OFF\n");//?
//?viPrintf(vi_4438c,"DM:STATE?ON\n");


//频谱仪? 
viPrintf(vi_spec,?"SYST:DISP:UPDate?ON\n");? 
viPrintf(vi_spec,?"FREQ:CENT?%dMHz\n",m_cent_freq);?
viPrintf(vi_spec,?"FREQ:SPAN?%dMHz\n",m_span);? 
viPrintf(vi_spec,?"DISP:WIND:TRAC:Y:RLEV?%ddBm\n",m_rlevel);?
viPrintf(vi_spec,?"BAND:VID?%dkHz\n",m_rbw);?
viPrintf(vi_spec,?"BAND:RES?%dkHz\n",m_vbw);?
viPrintf(vi_spec,?"CALC:MARK:AOFF\n");


//?
char?buf[255];? viPrintf(vi_spec,"INIT:CONT?OFF\n");?
viPrintf(vi_spec,"INIT:IMM;*WAI\n");?
viPrintf(vi_spec,"CALC:MARK:MAX\n");?
viPrintf(vi_spec,"*WAI\n");? 
viQueryf(vi_spec,"CALC:MARK:Y?\n","%t",buf);?
viPrintf(vi_spec,"*WAI\n");? 
viPrintf(vi_spec,"INIT:CONT?ON\n");
viPrintf(vi_spec,?"SWE:TIME?2s\n");


//功率计 /*  
viPrintf(vi_boonton,"SENS:CORR:OFFS 31dBm\n");//外部补偿电平 
viPrintf(vi_boonton,"DISP:TRAC:VCENT 55dBm\n");//参考电平 
viPrintf(vi_boonton,"TRIG:LEV 40dBm\n");//触发电平  
viPrintf(vi_boonton,"DISP:PULS:TIMEBASE 10us\n");//时间单位 
viPrintf(vi_boonton,"DISP:TRAC:VSCALe 5dB\n");//db/格 
viPrintf(vi_boonton,"*CLS\n");  
viPrintf(vi_boonton,"CALC:MODE PULSE\n");  
viPrintf(vi_boonton,"DISP:PARA:MODE MEAS\n");   
viPrintf(vi_boonton,"SENS:CORR:OFFS 0\n");//0dB//外部补偿电平 
viPrintf(vi_boonton,"TRIG:LEV 0\n");//触发电平  
viPrintf(vi_boonton,"DISP:TRAC:VCENT 0\n");//参考电平 
viPrintf(vi_boonton,"DISP:TRAC:VSCALe 5\n");//db/格10 
viPrintf(vi_boonton,"TRIG:DEL 0\n");//触发事件位置s 0  
viPrintf(vi_boonton,"DISP:PULS:TIMEBASE 5us\n");//pow 
viPrintf(vi_boonton,"DISP:PULS:TIMEBASE 5us\n"); 
viPrintf(vi_boonton,"*WAI\n");  
// viQueryf(vi_boonton,"FETCH:INTER:MAX ?\n","%t",buf); 
viQueryf(vi_boonton,"FETCH:ARRAY:AMEA:POW  ?\n","%t",buf);


viPrintf(vi_boonton,"TRIG:SLOP POS\n");  
viPrintf(vi_boonton,"DISP:PULS:TIMEBASE 100ns\n"); 
viPrintf(vi_boonton,"*WAI\n");  
viQueryf(vi_boonton,"FETCH:ARRAY:AMEA:TIM ?\n","%t",buf_time); 
viQueryf(vi_boonton,"FETCH:INTER:MAX ?\n","%t",buf_p);//0410 
viQueryf(vi_boonton,"FETCH:ARRAY:AMEA:POW  ?\n","%t",buf_p); 
viPrintf(vi_boonton,"*WAI\n"); 
str_time=buf_time;count=0;   


/测试下降沿  
viPrintf(vi_boonton,"TRIG:SLOP NEG\n"); 
viPrintf(vi_boonton,"*WAI\n");  
viQueryf(vi_boonton,"FETCH:ARRAY:AMEA:TIM ?\n","%t",buf_time); 
viQueryf(vi_boonton,"FETCH:ARRAY:AMEA:POW  ?\n","%t",buf_p2); 
//viQueryf(vi_boonton,"FETCH:INTER:MAX ?\n","%t",buf_p2);//均值
viPrintf(vi_boonton,"*WAI\n");?
//viQueryf(vi,"FETCH:INTER:AVER?\n","%t",buf);READ:INTER:AVER?
viQueryf(vi,"FETCH:INTER:MAX?\n","%t",buf);?READ:INTER:MAX??


//?
viPrintf(vi_zvb,?"SYST:DISP:UPDate?ON\n");?
viPrintf(vi_zvb,?"SWE:COUnt?%d\n",m_point);? 
viPrintf(vi_zvb,?"CALC:PAR:SEL?'CH1_S11_1'\n");?
viPrintf(vi_zvb,?"CALC:PAR:DEF?'My_S11',s11\n");?
//? 
viPrintf(vi_zvb,?"CALCulate1:PARameter:SELect?'Ch1Trc2'?'S21'\n");?? 


viPrintf(vi_zvb,?"SYST:DISP:UPDate?ON\n");?
viPrintf(vi_zvb,?"CALC:FORM?PHAS\n");


viPrintf(vi_zvb,?"FORMat?ASCII\n");? 
viQueryf(vi_zvb,?"INITiate1:CONTinuous?OFF;*OPC?\n","%",?ValueStr);?
viPrintf(vi_zvb,?"SENS1:FREQ:STAR?1000MHz\n");?
viPrintf(vi_zvb,?"SENS1:FREQ:STOP?1125MHz\n");?
viPrintf(vi_zvb,?"SENS1:SWE:POIN?126\n");?
viPrintf(vi_zvb,?"OUTP1??OFF\n");?
viPrintf(vi_zvb,?"SOUR:POW?-7\n");?
viPrintf(vi_zvb,"CALC1:MARK1?ON\n");

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值