Create Graph in User Display using SCPI Commands


This Visual Basic Scripting (vbs) program does the following:

The SCPI commands in this example are sent over a COM interface using the SCPIStringParser object. You do NOT need a GPIB connection to run this example.

This VBScript (*.vbs) program can be run as a macro in the analyzer. To do this, copy the following code into a text editor file such as Notepad and save it on the analyzer hard drive as User Display.vbs. Learn how to setup and run the macro.

See Also

User Display

 

 

' Create / Get the Anlayzer application.

Set app = CreateObject("AgilentPNA835x.Application")

set scpi = app.ScpiStringParser

'============================================

'Preset the analyzer

scpi.parse "SYST:PRES"

' Create User Display channel

scpi.parse "CALC:PAR:DEL:ALL"

scpi.parse "CALC:MEAS:DEF 'USER1:User Display'"   'Defines an USER1 measurement

scpi.parse "DISP:MEAS:FEED 1"  'Displays USER1 measurement in window 1

 

' X Axis setting

scpi.parse "SENS:USER:X:VAL 10,20,30,40,50"

scpi.parse "SENS:USER:X:AXIS:UNIT 's'"

scpi.parse "SENS:USER:X:AXIS:NAME 'Jitter'"

 

' Setting for USER1 data

scpi.parse "CALC:MEAS:Y:AXIS:UNIT:CUST ON"  ' Set the state of Y axis unit to ON

scpi.parse "CALC:MEAS:Y:AXIS:UNIT:CUST:DATA 'A'"  'Set and specified the Y axis unit

scpi.parse "CALC:MEAS:DATA:SDAT 1,0,2,0,3,0,4,0,5,0"

scpi.parse "DISP:WIND:TRAC1:TITL:DATA 'UD1'"

scpi.parse "DISP:WIND:TRAC1:TITL:STAT ON"

 

'add USER2 in new Window 2 Channel 2

scpi.parse "DISP:WIND2:STAT ON"

scpi.parse "CALC2:MEAS2:DEF 'USER1:User Display'"  'Defines an USER1 measurement

scpi.parse "DISP:MEAS2:FEED 2"   'Displays USER1 measurement in window 2

scpi.parse "SENS2:USER:X:VAL 20,30,40,50,60,70,80,90,100,110"

scpi.parse "SENS2:USER:X:AXIS:UNIT 's'"

scpi.parse "SENS2:USER:X:AXIS:NAME 'Jitter'"

scpi.parse "CALC:MEAS2:Y:AXIS:UNIT:CUST ON"

scpi.parse "CALC:MEAS2:Y:AXIS:UNIT:CUST:DATA 'ppm'"

scpi.parse "CALC2:MEAS2:DATA:SDAT 2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0"

scpi.parse "DISP:WIND2:TRAC:TITL:DATA 'UD2'"

scpi.parse "DISP:WIND2:TRAC:TITL:STAT ON"

 

' add USER3 in Window 2 Channel 2

scpi.parse "CALC2:MEAS3:DEF 'USER1:User Display'"

scpi.parse "DISP:MEAS3:FEED 2"

scpi.parse "CALC:MEAS3:Y:AXIS:UNIT:CUST ON"

scpi.parse "CALC:MEAS3:Y:AXIS:UNIT:CUST:DATA '%'"

scpi.parse "CALC2:MEAS3:DATA:SDAT 3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0"

scpi.parse "DISP:WIND2:TRAC2:TITL:DATA 'UD3'"

scpi.parse "DISP:WIND2:TRAC2:TITL:STAT ON"

 

scpi.parse "SENSe2:USER:X:AXIS:SPACing LOG" 'Set the X axis spacing to Logarithmic

scpi.parse "DISP:WIND2:Y:AUTO"  ' Autoscale for Window2