- 易迪拓培训,专注于微波、射频、天线设计工程师的培养
时域
概述
在Excel VBA中的样本程序
在HT Basic中的样本程序
概述
本样本程序介绍了如何使用时域函数的转换功能。
这个程序进行校准(电校准)、执行一次测量、将结果转换为时域格式的数据,并显示该数据。
参见这个程序的时域分析(时域功能)。
在Excel VBA中的样本程序
Sub Time_Domain_Click()
Dim defrm As Long 'Session to Default Resource Manager
Dim vi As Long 'Session to instrument
Dim Para As String
Dim Tran_Type As String
Dim Stim_Type As String
Dim stop_freq As Double
Dim Win_Beta As Double
Dim Star_Time As Double
Dim Stop_Time As Double
Dim Result As String
Const TimeOutTime = 40000 'timeout time.
stop_freq = 3000000000# 'Stop Frequendy : 3 GHz
Nop = 201 'Nop : 201
Para = "S11" 'Meas. Parameter : S11
Tran_Type = "LPAS" 'Transform Type : Lowpass
Stim_Type = "IMP" 'Stimulus Type : Impulse
Win_Beta = 13 'Window Beta : 13 (Maximum Type)
Star_Time = 0 'Start time : 0 sec
Stop_Time = 0.00000001 'Stop time : 10 nsec
Call viOpenDefaultRM(defrm) 'Initializes the VISA system.
Call viOpen(defrm, "GPIB0::17::INSTR", 0, 0, vi) 'Opens the session to the specified instrument.
Call viSetAttribute(vi, VI_ATTR_TMO_VALUE, TimeOutTime) 'The state of an attribute for the specified session.
Call viVPrintf(vi, ":SYST:PRES" & vbLf, 0) 'Presets the setting state of the ENA.
Call viVPrintf(vi, "*CLS" & vbLf, 0) 'Clears the all status register.
Call viVPrintf(vi, ":SENS1:FREQ:STOP " & stop_freq & vbLf, 0) 'Sets the sweep stop frequency.
Call viVPrintf(vi, ":SENS1:SWE:POIN " & Nop & vbLf, 0) 'Sets the number of points.
Call viVPrintf(vi, ":CALC1:TRAN:TIME:LPFR" & vbLf, 0) 'Sets a measurement point.
Call viVPrintf(vi, ":CALC1:PAR1:DEF " & Para & vbLf, 0) 'Sets the measurement parameter.
Call viVPrintf(vi, ":TRIG:SOUR BUS" & vbLf, 0) 'Sets the trigger source to BUS.
Call ErrorCheck(vi) 'Checking the error.
MsgBox "Connect Port1 to Ecal Module. Then click OK button.", vbOKOnly 'Display the message box.
Call viVPrintf(vi, ":SENS1:CORR:COLL:ECAL:SOLT1 1" & vbLf, 0) 'Execute the 1-port calibration.
Call viVPrintf(vi, "*OPC?" & vbLf, 0) 'Sets the *OPC? command.
Call viVScanf(vi, "%t", Result) 'Reads the *OPC? result.
Call ErrorCheck(vi) 'Checking the error.
MsgBox "Set DUT. Then click OK button.", vbOKOnly 'Display the message box.
Call viVPrintf(vi, ":TRIG:SING" & vbLf, 0) 'Execute the trigger.
Call viVPrintf(vi, "*OPC?" & vbLf, 0) 'Sets the *OPC? command.
Call viVScanf(vi, "%t", Result) 'Reads the *OPC? result.
Call viVPrintf(vi, ":DISP:WIND1:TRAC1:Y:AUTO" & vbLf, 0) 'Execute auto scale.
MsgBox "Click OK button. < Time Domain Transform >", vbOKOnly 'Display the message box.
Call viVPrintf(vi, ":CALC1:TRAN:TIME " & Tran_Type & vbLf, 0) 'Sets the transformation type.
Call viVPrintf(vi, ":CALC1:TRAN:TIME:STIM " & Stim_Type & vbLf, 0) 'Sets the stimulus type.
Call viVPrintf(vi, ":CALC1:TRAN:TIME:KBES " & Win_Beta & vbLf, 0) 'Sets the beta value of the window.
Call viVPrintf(vi, ":CALC1:TRAN:TIME:STAR " & Star_Time & vbLf, 0) 'Sets the start value of the display range.
Call viVPrintf(vi, ":CALC1:TRAN:TIME:STOP " & Stop_Time & vbLf, 0) 'Sets the end value of the display range.
Call viVPrintf(vi, ":CALC1:TRAN:TIME:STAT ON" & vbLf, 0) 'Turns on the time domain function.
Call ErrorCheck(vi) 'Checking the error.
Call viVPrintf(vi, ":CALC1:PAR1:SEL" & vbLf, 0) 'Sets the active trace.
Call viVPrintf(vi, ":CALC1:FORM REAL" & vbLf, 0) 'Sets the real data format.
Call viVPrintf(vi, ":DISP:WIND1:TRAC1:Y:AUTO" & vbLf, 0) 'Execute auto scale.
Call ErrorCheck(vi) 'Checking the error.
Call viClose(vi) 'Closes the resource manager session.
Call viClose(defrm) 'Breaks the communication and terminates the VISA system.
End 'End
End Sub
在HT Basic中的样本程序
10 DIM Para$[9],Tran_type$[9],Stim_type$[9],Buff$[9],Inp_ch ar$[9]
20 REAL Stop_freq,Win_beta,Star_time,Stop_time
30 INTEGER Nop
40 !
50 ASSIGN @Agte507x TO 717
60 !
70 Stop_freq=3.E+9 ! Stop Frequency : 3 GHz
80 Nop=201 ! Nop : 201
90 Para$="S11" ! Meas. Parameter : S11
100 !
110 Tran_type$="LPAS" ! Transform Type : Lowpass
120 Stim_type$="IMP" ! Stimulus Type : Impulse
130 Win_beta=13 ! Window Beta : 13 (Maximum Type)
140 Star_time=0 ! Start time : 0 s
150 Stop_time=1.E-8 ! Stop time : 10 ns
160 !
170 OUTPUT @Agte507x;":SYST:PRES"
180 OUTPUT @Agte507x;":SENS1:FREQ:STOP ";Stop_freq
190 OUTPUT @Agte507x;":SENS1:SWE:POIN ";Nop
200 !
210 OUTPUT @Agte507x;":CALC1:TRAN:TIME:LPFR"
220 !
230 OUTPUT @Agte507x;":CALC1:PAR1:DEF "&Para$
240 OUTPUT @Agte507x;":TRIG:SOUR BUS"
250 !
260 ! 1 Port Full Calibration (ECal)
270 !
280 PRINT "Connect Port 1 to ECal Module. Then push [Enter] key."
290 INPUT "",Buff$
300 OUTPUT @Agte507x;":SENS1:CORR:COLL:ECAL:SOLT1 1"
310 OUTPUT @Agte507x;":SYST:ERR?"
320 ENTER @Agte507x;Buff$
330 !
340 ! Measurement
350 !
360 PRINT "Set DUT. Then Push [Enter] key."
370 INPUT "",Inp_char$
380 !
390 OUTPUT @Agte507x;":TRIG:SING"
400 OUTPUT @Agte507x;"*OPC?"
410 ENTER @Agte507x;Buff$
420 !
430 OUTPUT @Agte507x;":DISP:WIND1:TRAC1:Y:AUTO"
440 PRINT "Push [Enter] key. -> [Time Domain Transform]"
450 INPUT "",Inp_char$
460 !
470 ! Time Domain Transform
480 !
490 OUTPUT @Agte507x;":CALC1:TRAN:TIME "&Tran_type$
500 OUTPUT @Agte507x;":CALC1:TRAN:TIME:STIM "&Stim_type$
510 OUTPUT @Agte507x;":CALC1:TRAN:TIME:KBES ";Win_beta
520 OUTPUT @Agte507x;":CALC1:TRAN:TIME:STAR ";Star_time
530 OUTPUT @Agte507x;":CALC1:TRAN:TIME:STOP ";Stop_time
540 OUTPUT @Agte507x;":CALC1:TRAN:TIME:STAT ON"
550 !
560 OUTPUT @Agte507x;":CALC1:PAR1:SEL"
570 OUTPUT @Agte507x;":CALC1:FORM REAL"
580 OUTPUT @Agte507x;":DISP:WIND1:TRAC1:Y:AUTO"
590 END