This example program does the following:
Setup four VCO Characterization Parameters (Frequency, Power, V Control Current, V Supply1 Current)
Setup Stimulus
Make a trigger
Save the measurement result into a file.
This VBScript program can be run as a macro in the analyzer. To do this, copy the code into a text editor file such as Notepad and save on the analyzer SSD as vco.vbs. Learn how to setup and run the macro.
Learn more about Impedance Analysis
See Other SCPI Example Programs
' VCO Characterization ' Dim app Dim scpi Dim NoP Dim dataVoltage dim dataFrequency dim dataPower dim dataCurrentVc dim DataCurrentVs1 Dim strTemp Dim objFSO Dim objFile ' Create / Get the SSA application. Set app = CreateObject("AgilentPNA835x.Application") Set scpi = app.ScpiStringParser ' Preset scpi.parse "SYST:FPR" ' Set the trigger at manual trigger scpi.parse "TRIG:SOUR MAN" ' Create four windows scpi.parse "DISP:WIND1 ON" scpi.parse "DISP:WIND2 ON" scpi.parse "DISP:WIND3 ON" scpi.parse "DISP:WIND4 ON" ' Define Parameters ' Trace 1: Frequency scpi.parse "CALC:MEAS1:DEF 'Freq:VCO Characterization'" scpi.parse "DISP:MEAS1:FEED 1" scpi.parse "CALC1:MEAS1:FORM FREQ" ' Trace 2: Power scpi.parse "CALC:MEAS2:DEF 'Power:VCO Characterization'" scpi.parse "DISP:MEAS2:FEED 2" scpi.parse "CALC1:MEAS2:FORM MLOG" ' Trace 3: V Control Current scpi.parse "CALC:MEAS3:DEF 'CurrentVC:VCO Characterization'" scpi.parse "DISP:MEAS3:FEED 3" scpi.parse "CALC1:MEAS3:FORM REAL" ' Trace 4: V Supply 1 Current scpi.parse "CALC:MEAS4:DEF 'CurrentVS1:VCO Characterization'" scpi.parse "DISP:MEAS4:FEED 4" scpi.parse "CALC1:MEAS4:FORM REAL"
' Setup for Stimulus scpi.parse "SYST:DC:DEF:OUTP:VOLT 'VSupply1', 12" ' Set the default voltage for Vsupply 1 scpi.parse "SOUR:DC:STAR 'VControl', 0" ' Sweep Start Voltage scpi.parse "SOUR:DC:STOP 'VControl', 18" ' Sweep End Voltage scpi.parse "SENS:VCO:SWE:SOUR 'VControl'" ' Set sweep parameter at VControl scpi.parse "SENS:SWEEP:POIN 101"
scpi.parse "SYST:DC:DEF:OUTP:STAT 'VSupply1', ON" ' Turn on the default state for Vsupply1 scpi.parse "SYST:DC:DEF:OUTP:STAT 'VControl', ON" ' Turn on the default state for VContorl
scpi.parse "SYST:DC:ENAB ON" ' Turn on all DC source.
scpi.parse "SENS:VCO:FREQ:BAND R8G" ' Set the frequency band scpi.parse "SENS:VCO:FREQ:RES R10" ' Set the resolution
' Check for Ready for Trigger Do While strTemp = 0 strTemp = scpi.parse("TRIG:STAT:READ? MAN") Loop
' Trigger scpi.parse "INIT:IMM" strTemp = scpi.parse("*OPC?")
' Auto Scale for all windows scpi.parse "DISP:WIND1:TRAC1:Y:AUTO" scpi.parse "DISP:WIND2:TRAC1:Y:AUTO" scpi.parse "DISP:WIND3:TRAC1:Y:AUTO" scpi.parse "DISP:WIND4:TRAC1:Y:AUTO"
' Get the number of points NoP = scpi.parse(":SENS1:SWE:POIN?") ' Get the data for X axis StrTemp = scpi.parse(":CALC1:MEAS1:DATA:X?") strTemp = Replace(strTemp, vbLf, "") ' Delete a line feed code dataVoltage = Split(StrTemp, ",")
' Get the measurement data strTemp = scpi.parse(":CALC1:MEAS1:DATA:FDAT?") strTemp = Replace(strTemp, vbLf, "") dataFrequency = Split(StrTemp, ",")
strTemp = scpi.parse(":CALC1:MEAS2:DATA:FDAT?") strTemp = Replace(strTemp, vbLf, "") dataPower = Split(StrTemp, ",")
strTemp = scpi.parse(":CALC1:MEAS3:DATA:FDAT?") strTemp = Replace(strTemp, vbLf, "") dataCurrentVc = Split(StrTemp, ",")
strTemp = scpi.parse(":CALC1:MEAS4:DATA:FDAT?") strTemp = Replace(strTemp, vbLf, "") dataCurrentVs1 = Split(StrTemp, ",")
' Saving the result into a file Set objFSO = WScript.CreateObject("Scripting.FileSystemObject") If Err.Number = 0 Then Set objFile = objFSO.OpenTextFile("Result.csv", 2, True) If Err.Number = 0 Then ' Output Phase Noise result into the file. objFile.Writeline("Number of Data:"&NoP) objFile.Writeline("Voltage, Frequency, Power, Current VC, Curret VS1") For i = 0 To NoP-1 objFile.Writeline(dataVoltage(i)&", "&dataFrequency(i)&", "&dataPower(i)&", "&dataCurrentVc(i)&", "&dataCurrentVs1(i)) Next
objFile.Close Else WScript.Echo "File Open Error: " & Err.Description End If Else WScript.Echo "Error: " & Err.Description End If Set objFile = Nothing Set objFSO = Nothing |