SCPI Protocol - Table of Contents 1. 2. 3. Introduction to the SCPI Language ..................................................................................... 1 1.1. Communication Interfaces ........................................................................................ 1 1.2. Command Syntax ....................................................................................................... 1 1.3. Symbol Description ...................................................................
11. :FUNCtion:PULSe:WIDTh ....................................................................................... 10 12. :FUNCtion:ARB:BUILtinwform ................................................................................ 10 13. :FUNCtion:ARB:FILE ............................................................................................... 11 14. :FUNCtion:DC:VOLTage .......................................................................................... 11 15.
4. 5. 6. 7. 35. :FUNCtion:BURSt:NCYCle ..................................................................................... 19 36. :FUNCtion:BURSt:INFinite ...................................................................................... 20 37. :FUNCtion:BURSt:POLarity .................................................................................... 20 38. :FUNCtion:BURSt:SOURce .................................................................................... 20 39.
8. 6. :COUNter:SENSitivity .................................................................................................. 29 7. :COUNter:HFR .............................................................................................................. 30 8. :COUNter:TRIGlev ....................................................................................................... 30 Application Examples ..................................................................................................
1. Introduction to the SCPI Language 1.1. Communication Interfaces Computers communicate with the P4120 - 4165 series generator by sending and receiving commands over USB or RS232 interface. Command is sent and identified in the form of ASCII character strings for users to easily control the generator and do user-defined development. Operations that you can do with a computer and a generator include: Set the generator and output waveforms from the generator.
does not work, "NULL\n" will be returned. After one of the complete commands, if the following command has the same first-level keyword or the same first-level and second-level keywords (keywords have 3 levels most), the same keywords in the following command can be omit, the command can be written as the rest parts. E.g. :func:sine:freq 1000 //Complete command :ampl 2 //Omit first-level func and second-level sine :squ:offset 1 //Omit first-level func 1.3.
a) Boolean Parameters The parameters could be “OFF” or “ON” (“0” or “1”), for example, :CHANnel:CH1 {OFF|ON} “OFF” denotes disabling the output of CH1. “On” denotes enabling the output of CH1. b) Consecutive Integer Parameters The parameters could be a consecutive integer, for example, :FUNCtion:ARB:BUILtinwform could be any integer between 0 and 25(including 0 and 25).
1.6. Available Command for Different Model Note: Not every model of this series has the same functions, as for example some entry-level devices do not have any modulation modes. So all SCPI command for these (not integrated) functions will not work and are invalid. For models without frequency counter, all command for the counter are invalid.
2. Common Commands This Series supports following IEEE488.2 commands: 1. *IDN Syntax *IDN? Function Query ID character string of instrument. Explanations The query returns 4 character segments separated by commas “,”: manufacturer, model, serial number and the edition number. Example *IDN? returns PeakTech,P4120,P41200221331030,V_4.0.1 2. *RST Syntax *RST Function Restore the instrument to its default value.
3. :FUNCtion Commands The control commands of waveform function are as follows: 1. :FUNCtion Syntax :FUNCtion? :FUNCtion {SINE|SQUare|RAMP|PULSe|NOISe|ARB|DC|AM|FM|PM|FSK|PWM|S WEep|BURSt} Function Query/set the waveform function for current channel. Explanations This command work on the current selected channel by default. If you want to set the other channel, you need switch channel first (refer to the command of channel control, such as CHANnel CH2). Example :FUNCtion RAMP 2.
Example :FUNCtion:SINE:LOAD 123 3. :FUNCtion:{SINE|SQUare|RAMP|PULSe|ARB}:FREQuency Syntax :FUNCtion:{SINE|SQUare|RAMP|PULSe|ARB}:FREQuency? :FUNCtion:{SINE|SQUare|RAMP|PULSe |ARB}:FREQuency {} Function Query/set the frequency of output function for current channel. Explanations is the frequency set by user, the default unit is Hz. NOISE does not have frequency parameter. The query returns the frequency set in scientific notation, such as: 1.
:FUNCtion:{SINE|SQUare|RAMP|PULSe |ARB}:AMPLitude {} Function Query/set the amplitude (PK-PK) of output function for current channel. Explanations is the amplitude set by users, the default unit is Vpp. Example :FUNCtion:RAMP:AMPLitude 2 sets the amplitude as 2Vpp 6.
8. :FUNCtion:{SINE|SQUare|RAMP|PULSe|NOISe|ARB}:LOW Syntax :FUNCtion:{SINE|SQUare|RAMP|PULSe|ARB}:LOW? :FUNCtion:{SINE|SQUare|RAMP|PULSe |ARB}:LOW {} Function Query/set the low level of output function for current channel. Explanations is the low level set by users, the default unit is V. Example :FUNCtion:RAMP:LOW 2 sets the low level as 2V. 9.
Example 11. :FUNCtion:RAMP:SYMMetry 20 sets the symmetry of ramp wave as 20% :FUNCtion:PULSe:WIDTh Syntax :FUNCtion:PULSe:WIDTh? :FUNCtion:PULSe:WIDTh {} Function Query/set the width of pulse wave for current channel. Explanations is the width set by users, the default unit is S. Example :FUNCtion:PULSe:WIDTh 1.0E-04 sets the width of pulse wave as 100μs 12.
13. :FUNCtion:ARB:FILE Syntax :FUNCtion:ARB:FILE? :FUNCtion:ARB:FILE {} Function Query/read the data file of arbitrary wave stored in the root directory of flash for current channel. Explanations If the arbitrary wave is selected as the data file stored in flash, the query returns the name of data file; read outputs the wave stored in flash with the name . Example :FUNCtion:ARB:FILE 999.bin sets the arbitrary wave as 999.bin in flash. :FUNCtion:ARB:FILE? returns 999.bin 14.
:FUNCtion:{AM|FM|PM|PWM}:SHAPe {} Function Query/set the internal modulating wave of {AM|FM|PM|PWM} Explanations In internal modulation mode, the modulating wave could be sine, square, ramp, noise or arbitrary wave, the default is sine. Noise cannot be set for PWM Example 16. :FUNCtion:AM:SHAPe SQU sets the modulating wave of AM as square.
18. :FUNCtion:{AM|FM|PM|FSK|PWM}:SOURce Syntax :FUNCtion:{AM|FM|PM|FSK|PWM}:SOURce? :FUNCtion:{AM|FM|PM|FSK|PWM}:SOURce {INTernal|EXTernal} Function Query/set internal or external modulation source of {AM|FM|PM|FSK|PWM} Explanations Example :FUNCtion:AM:SOURce EXT sets the modulation source of AM as external. 19. :FUNCtion:FM:DEViation Syntax :FUNCtion:FM:DEViation? :FUNCtion:FM:DEViation {} Function Query/set the frequency deviation of FM.
Explanations The unit of is degree (°). Range: 0° to 180° Example :FUNCtion:PM:PHASe 100 set the phase deviation of PM as 100° 21. :FUNCtion:FSK:RATE Syntax :FUNCtion:FSK:RATE? :FUNCtion:FSK:RATE {} Function Query/set the modulating rate of FSK. Explanations The unit of is Hz. Rate range: 2mHz~100kHz。 Example :FUNCtion:FSK:RATE 100 set the modulating rate of FSK as 100Hz 22.
Function Query/set the width deviation of PWM. Explanations The unit of is s. Example :FUNCtion:PWM:DEViation 2.00E-04 sets the width deviation of PWM as 200μs 24. :FUNCtion:SWEep:SWEeptime Syntax :FUNCtion:SWEep:SWEeptime? :FUNCtion:SWEep:SWEeptime {} Function Query/set the sweep time needed for the generator to sweep from the start frequency to the stop frequency. Explanations The unit of is s.
26. :FUNCtion:SWEep:STARtfreq Syntax :FUNCtion:SWEep:STARtfreq? :FUNCtion:SWEep:STARtfreq {} Function Query/set the start frequency for the sweep. Explanations The start frequency can be greater than the stop frequency; is used with together. Example :FUNCtion:SWEep:STARtfreq 100 sets the start frequency of sweep as 100Hz 27.
Explanations
is used with together. Example :FUNCtion:SWEep:CENTrefreq 1000 sets the center frequency of sweep as 1000Hz 29. :FUNCtion:SWEep:SPAN Syntax :FUNCtion:SWEep:SPAN? :FUNCtion:SWEep:SPAN{} Function Query/set the frequency span for the sweep. Explanations Example 30.Example :FUNCtion:SWEep:SOURce EXTernal sets the source of the sweep as external. 31. :FUNCtion: SWEep:TRIGger Syntax :FUNCtion: SWEep: TRIGger 1 Function The generator is triggered once for sweep Explanations This command is valid only when the source is set as manual. The parameter 1 is meaningless; it can be any other value. This command only trigger once every time. Example :FUNCtion: SWEep: TRIGger 1 32.
:FUNCtion:BURSt:PHASe {} Function Query/set the start phase of burst. Explanations Range: -360°~+360° Example :FUNCtion:BURSt:PHASe 120 sets the start phase of burst as 120° 34. :FUNCtion:BURSt:MODE Syntax :FUNCtion:BURSt:MODE? :FUNCtion:BURSt:MODE { NCYCles|GATed} Function Query/set the burst mode (N-Cycle or Gated). Explanations Example 35. :FUNCtion:BURSt:MODE GATed sets the burst mode as N-Cycle.
36. :FUNCtion:BURSt:INFinite Syntax :FUNCtion:BURSt:INFinite? :FUNCtion:BURSt:INFinite {CYCLes|INFinite } Function Query/set the cycle number of burst (finite or infinite). Explanations This command is invalid in gated mode. Example :FUNCtion:BURSt:INFinite INFinite sets the cycle number of burst as infinite. 37. :FUNCtion:BURSt:POLarity Syntax :FUNCtion:BURSt:POLarity? :FUNCtion:BURSt:POLarity { POSitive | NEGative } Function Query/set the polarity of burst in gated mode.
Example 39. :FUNCtion:BURSt:SOURce EXTernal sets the source of burst as external. :FUNCtion:BURSt:TRIGger Syntax :FUNCtion:BURSt: TRIGger 1 Function The generator is triggered once for burst Explanations This command is valid only when the source is set as manual. The parameter 1 is meaningless; it can be any other value. This command only trigger once every time.
4. :FILE Commands The commands used for controlling data file of arbitrary waves are as follows: 1. :FILE:UPLoad Syntax :FILE:UPLoad , Function Upload a data file of arbitrary wave (from PC to the generator). Explanations The uploading file shouldn't be too large and should be the recognized format by the generator. Example :FILE:UPLoad 1234,sine.bin 2.
Example :FILE:FILEname? returns “999.bin,abc.bin” 4. :FILE:DELete Syntax :FILE: DELete < file name to be deleted> Function Delete the specified file from the flash of the generator Explanations The file name must be complete and is case-sensitive. Return NULL if the specified file does not exist. Example :FILE: DELete 123.
5. :SYSTem Commands The commands of system control are as follows: 1. :SYSTem:VERSion Syntax :SYSTem:VERSion? Function Query the software edition number of the instrument. Explanations Example :SYSTem:VERSion? returns “V_4.0.1” 2. :SYSTem:CLKSrc Syntax :SYSTem:CLKSrc? :SYSTem:CLKSrc {INTernal|EXTernal} Function Query/set the system clock source.
Function Query/set the system language.
6. :CHANnel Commands The commands of channel control are as follows: 1. :CHANnel Syntax :CHANnel? :CHANnel {CH1|CH2} Function Query/set current channel. Explanations Example :CHANnel?(returns {CH1|CH2}) :CHANnel CH2 2. :CHANnel:CH1 Syntax :CHANnel:CH1? :CHANnel:CH1{ON|OFF|1|0} Function Query/set the state of CH1 output. Explanations Example :CHANnel:CH1?(returns {ON|OFF}) :CHANnel:CH1 ON 3.
Function Query/set the state of CH2 output.
7. :COUNter Commands The commands of counter control are as follows: 1. :COUNter:FREQuency Syntax :COUNter:FREQuency? Function Query the frequency measurement value of the counter. Explanations Example :COUNter:FREQuency? returns “1.000006E+03” 2. :COUNter:PERiod Syntax :COUNter:PERiod? Function Query the period measurement value of the counter. Explanations Example :COUNter:PERiod? returns “9.999793E-04” 3.
4. :COUNter:DTYCycle Syntax :COUNter:DTYCycle? Function Query the duty cycle measurement value of the counter. Explanations Example :COUNter:DTYCycle? returns “5.000000E+01” 5. :COUNter:COUPling Syntax :COUNter:COUPling? :COUNter:COUPling {AC|DC} Function Query/set the coupling mode. Explanations Example :COUNter:COUPling?(returns {AC|DC}) :COUNter:COUPling AC 6. :COUNter:SENSitivity Syntax :COUNter:SENSitivity? :COUNter:SENSitivity {LOW,MIDD,HIGH} Function Query/set the trigger sensitivity.
LOW 7. :COUNter:HFR Syntax :COUNter:HFR? :COUNter:HFR {ON|OFF} Function Query/set the state of high-frequency reject. Explanations Example :COUNter:HFR?(returns {ON|OFF}) :COUNter:HFR ON 8. :COUNter:TRIGlev Syntax :COUNter:TRIGlev? :COUNter:TRIGlev Function Query/set the trigger level of the counter. Explanations Example :COUNter:TRIGlev?(returns “0.000000E+00”) :COUNter:TRIGlev 1.
8. Application Examples E.g. 1: To Generate a Sine Wave via CH1 Target: Generate a sine wave with 20 kHz frequency, 2.5 Vpp amplitude, 500mV offset via CH1. Step SCPI Command Comment 0 *IDN? /*Query ID to check the operating state*/ 1 :CHAN CH1 /*Set current channel as CH1*/ 2 :FUNC:SINE:LOAD OFF /*Set the load as High Z*/ 3 :FUNC:SINE:FREQ 20000 /*Set the frequency of the sine wave*/ 4 :FUNC:SINE:AMPL 2.5 /*Set the amplitude*/ 5 :FUNC:SINE:OFFS 0.
E.g. 2: To Generate a Built-in Arbitrary Wave via CH2 Target: Generate an ExpRise wave with 2MHz frequency, 5Vpp amplitude, 10mV offset and 100Ω load via CH2. Step SCPI Command Comment 0 *IDN? /*Query ID to check the operating state*/ 1 :CHAN CH2 /*Set current channel as CH2*/ 2 :FUNC:SINE:LOAD 100 /*Set the load as 100Ω*/ 3 :FUNC:ARB:FREQ 2.0E+06 /*Set the frequency of the arbitrary wave*/ 4 :FUNC:ARB:AMPL 5 /*Set the amplitude*/ 5 :FUNC:ARB:OFFS 0.
E.g. 3: To Generate a FSK Wave via CH1 Target: Generate a FSK wave with 10 kHz, 5 Vpp, 0 V offset carrier wave (Sine), internal modulation source, 800 Hz hop frequency and 200 Hz FSK rate via CH1.
E.g. 4: To Generate a Linear Sweep Wave via CH1 and a Ramp Wave via CH2 Target: Generate a sweep square wave with 100Hz to 1kHz frequency, internal trigger, linear mode and 5s sweep time via CH1. Generate a 1.5kHz, 5Vpp, 1V, 33% symmetry ramp wave via CH2.
17 :CHAN:CH2 ON /*Enable the connector of CH2 at front panel*/ Note: If the parameters of the generator are not explicit, all the relevant parameters of the output waveform should be set; if the parameters are explicit and meet the set requirements of the output waveform, you do not need to set them.
AppendixⅠ a) b) Default unit of numerical parameters Parameter Type Default Unit Frequency Hertz/Hz Time Second/S Amplitude PK-PK/Vpp Offset voltage, level Volt/V Load ohm/Ω percent % Phase Degree/° Cycle number Cycle Number and name of build-in arbitrary wave No.
9 ExpRise 10 ExpFall 11 Sinc 12 Tan 13 Cot 14 Sqrt 15 x^2 16 Rectangle 17 Gauss 18 Hamming 19 Hann 20 Bartlett 21 Blackman 22 Laylight 23 DC 24 Heart 25 Round AppendixⅡ:Commands Reference *IDN?, 4 COUNter:COUPling, 20 *RST, 4 COUNter:DTYCycle?, 19 CHANnel, 18 COUNter:FREQuency?, 19 CHANnel:CH1, 18 COUNter:HFR, 20 CHANnel:CH2, 18 COUNter:PERiod, 19 37
COUNter:PWIDth?, 19 FUNCtion:ARB:BUILtinwform, 8 COUNter:SENSitivity, 20 FUNCtion:ARB:FILE, 8 COUNter:TRIGlev, 20 FUNCtion:BURSt:INFinite, 14 FILE:DOWNload, 16 FUNCtion:BURSt:MODE, 14 FILE:FILEname, 16 FUNCtion:BURSt:NCYCle, 14 FILE:UPLoad, 16 FUNCtion:BURSt:PERiod, 13 FUNCtion, 5 FUNCtion:BURSt:PHASe, 13 FUNCtion:{AM|FM|PM|FSK|PWM}:SOU FUNCtion:BURSt:POLarity, 14 Rce, 9 FUNCtion:BURSt:SOURce, 13, 15 FUNCtion:{AM|FM|PM|PWM}:FREQuen FUNCtion:DC:VOLTege, 8 cy, 9 FUNCtion:FM:DEViation, 10
FUNCtion:SWEep:SWEeptime, 11 SYSTem:LANGuage, 17 SYSTem:CLKSrc, 17 SYSTem:VERSion, 17 39