功率计远程控制

功率计 Boonton4500B GPIB远程控制

viFindRsrc,viFindNext,viParseRsrc

#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_pow[255],buf_time[255];

ViSession vi;

ViSession vi_Boonton;

//打开功率计 Boonton,4500B

viOpenDefaultRM(&vi);

if(VI_SUCCESS != viOpen(vi,GPIB0::28::INSTR, VI_NULL,VI_NULL, &vi_Boonton)){

    //仪器打开失败

Return;

}

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");//*/

viPrintf(m_gpib.vi_Boonton,"*CLS\n");

//测试功率----------------------------------------------

viQueryf(vi_Boonton,"FETCH:ARRAY:AMEA:POW  ?\n","%t",buf);

//TODO strtok函数处理

//测试下降沿-------------------------------------------

viPrintf(m_gpib.vi_Boonton,"TRIG:SLOP POS\n");

viPrintf(m_gpib.vi_Boonton,"DISP:PULS:TIMEBASE 100ns\n");

viPrintf(m_gpib.vi_Boonton,"*WAI\n");

viQueryf(m_gpib.vi_Boonton,"FETCH:ARRAY:AMEA:TIM ?\n","%t",buf_time);

viQueryf(m_gpib.vi_Boonton,"FETCH:INTER:MAX ?\n","%t",buf_pow);

viPrintf(m_gpib.vi_Boonton,"*WAI\n");

//测试下降沿-------------------------------------------

viPrintf(m_gpib.vi_Boonton,"TRIG:SLOP NEG\n");

viPrintf(m_gpib.vi_Boonton,"*WAI\n");

viQueryf(m_gpib.vi_Boonton,"FETCH:ARRAY:AMEA:TIM ?\n","%t",buf_time);

viQueryf(m_gpib.vi_Boonton,"FETCH:INTER:MAX ?\n","%t",buf_pow);//均值

viPrintf(m_gpib.vi_Boonton,"*WAI\n");

viClose(vi);

viClose(vi_Boonton);

测试同步的三种方法

1*WAI     //single sweep mode

INIT:CONT OFF

INIT;*WAI

CALC:MARK:MAX;Y?

或者

INIT:CONT OFF

INIT

*WAI

CALC:MARK:MAX;Y?

2.*opc? 

3. 3.*OPC

INIT;*OPC

注意事项, Timebase 和Trigger Delay有一个关系:

          Argument:               Timebase                            Trigger Delay    <arg> 

                              5 nsec/div to 500 nsec/div             -4 msec to +100 msec 

                              1 usec/div to 10 msec/div               4000 divisions 

                              20 msec/div to 3600 sec/div            -40 to +100 sec 

参考文档:4500B_InstructionManual.pdf

你可能感兴趣的:(远程控制,VISA,GPIB,功率计远程控制,SICL)