Agilent technologies N9344C, N9343C, N9342C User Manual

Agilent N9342C/43C/44C Handheld Spectrum Analyzer

Programmer’s Guide

Notices
CAUTION
WARNING
© Agilent Technologies, Inc. 2012
Part Number
N9342-90066
Edition
Third Edition, October. 2012
Agilent Technologies, Inc. No. 116 Tuo Xin West 1st Street Hi-Tech Industrial Zone (South) Chengdu 610041, China
Software Revision
This guide is valid for Version A.04.20 or later of the N9342C/43C/44C handheld spectrum analyzer firmware.
Warranty
The material contained in this document is provided “as is,” and is subject to being changed, without notice, in future editions. Further, to the maximum extent permitted by applicable law, Agilent disclaims all warranties, either express or implied, with regard to this manual and any information contained herein, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Agilent shall not be liable for errors or for incidental or consequential damages in connection with the furnishing, use, or performance of this document or of any information contained herein. Should Agilent and the user have a separate written agreement with warranty terms covering the material in this document that conflict with these terms, the warranty terms in the separate agreement shall control.
Restricted Rights Legend
U.S. Government Restricted Rights. Software and technical data rights granted to the federal government include only those rights customarily provided to end user customers. Agilent provides this customary commercial license in Software and technical data pursuant to FAR 12.211 (Technical Data) and 12.212 (Computer Software) and, for the Department of Defense, DFARS 252.227-7015 (Technical Data - Commercial Items) and DFARS
227.7202-3 (Rights in Commercial Computer Software or Computer Software Documentation).
Technology Licenses
The hardware and/or software described in this document are furnished under a license and may be used or copied only in accordance with the terms of such license.
Safety Notices
A CAUTION notice denotes a hazard. It calls attention to an operating procedure, practice, or the like that, if not correctly performed or adhered to, could result in damage to the product or loss of important data. Do not proceed beyond a CAUTION notice until the indicated conditions are fully understood and met.
A WARNING notice denotes a hazard. It calls attention to an operating procedure, practice, or the like that, if not correctly performed or adhered to, could result in personal injury or death. Do not proceed beyond a WARNING notice until the indicated conditions are fully understood and met.
In This Guide…
This guide contains programming information for the N9342C/43C/44C Handheld Spectrum Analyzer.
1 Getting Started
Prepare for the remote control.
2 Programming Fundamentals
A quick overview of the SCPI programming.
3 Status Registers
Introduction of the status registers.
4 Programming Example
How to accomplish the basic applications in programming.
5 Command Reference
Describe every programming command ant the related softkeys’ functions in detail.
For more information about the HSA handheld spectrum analyzer, please refer to:
Programmer’s Guide
N9342C handheld spectrum analyzer:
www.agilent.com/find/n9342c
N9343C handheld spectrum analyzer:
www.agilent.com/find/n9343c
N9344C handheld spectrum analyzer:
www.agilent.com/find/n9344c
Programmer’s Guide

Contents

1 Getting Started 1
Remotely Operating the Analyzer 2
Computer Requirement for Remote Operation 2 Connecting the Analyzer via the USB Port 3 Connecting the Analyzer via the LAN Port 6
2 Programming Fundamentals 9
Overview 10
Command Categories 12
Command Syntax 13
Creating Valid Commands 15
Program and Response Messages 16
Parameters in Commands 17
3Status Registers 19
Overview 20
Programmer’s Guide
How to use the Status Registers 23
Status Register System 25
4 Programming Example 31
Overview 32
Programming in C using the VTL 33
Checking the USB Connection 39
Using C with Marker Peak Search and Peak Excursion 40
Using Marker Delta Mode and Marker Minimum Search 44
Contents
5 Command Reference 49
IEEE Common Commands 50
System Subsystem 54
Memory Subsystem 66
Instrument Subsystem 70
Sense Subsystem 72
Frequency Subsection 72 Amplitude Subsection 76 Bandwidth Subsection 81 Trac e S u bs e ct i on 83 Detector Subsection 85 Average Subsection 86 Sweep Subsection 87 Display Subsection 90
Calculate Subsystem 91
Limit Line Subsection 91 Marker Subsection 95
Initiate Subsystem 102
Trig ger Sub sy s te m 104
Power Measurement Subsystem 108
ACPR Subsection 108 CHP Subsection 111 OBW Subsection 115 SEM Subsection 117
Spectrum Monitor Option Subsystem 127
Cable and Antenna Test Option Subsystem 134
Channel Scanner Option Subsystem 148
Demodulation Option Subsystem 165
Programmer’s Guide
AM Demodulation Subsection 168 FM Demodulation Subsection 175 ASK Demodulation Subsection 182 FSK Demodulation Subsection 191
Power Meter Option Subsystem 201
Tracking Generator Option Subsystem 214
Contents
Programmer’s Guide
Contents
Programmer’s Guide
Agilent N9342C/43C/44C Handheld Spectrum Analyzer Programmer’s Guide
1 Getting Started
The purpose of this chapter is to serve as a reminder of SCPI (Standard Commands for Programmable Instruments) fundamentals to those who have previous experience in programming SCPI. This chapter is not intended to teach you everything about the SCPI programming language. If you are using an optional programming compatibility modes, you should refer to the manual that came with the option.
1
1 Getting Started

Remotely Operating the Analyzer

The analyzer provides both the USB and LAN connection which allows you to set up a remote operation environment with a controller computer. A controller computer could be a personal computer (PC), a minicomputer. Some intelligent instruments also function as controllers.
Computer Requirement for Remote Operation
Usually, you need to prepare an compatible PC with the following requirements to set up a remote operation environment:
Processor: 450 MHz Pentium
Operating system: Microsoft
Service Pack 1 or later; Windows later
Available memory: 128 MB or higher required
Available disk space: 175 MB or greater required
® II or higher required
® Windows® XP or Home Editon,
® 2000 Professional, service pack 4 or
2 Programmer’s Guide
Connecting the Analyzer via the USB Port
Connecting instrument
Connecting PC
No extra driver is required to connect the analyzer via the USB port to a PC. All you need is the Agilent IO libraries suite and you can find this IO libraries suite in the documentation CD in the shipment along with your analyzer. Or download the IO libraries suite from Agilent website:
http://www.agilent.com/find/iolib
Refer to the following steps to finish the connection:
1 Install Agilent IO libraries suite on your PC
2 Switch on the analyzer
3 Connect the analyzer to a PC with a USB cable.
Getting Started 1
Programmer’s Guide 3
1 Getting Started
4 After a while, the PC finds your analyzer as a new hardware and
prompts a message saying “Found new hardware...”. A Found New Hardware Wizard is initiated immediately.
5 Select Display a list...
4 Programmer’s Guide
Getting Started 1
7 PC will detect the instrument automatically. The item “USB Test and
Measurement Device” displays in the pop-up window. Select it and
press Next.
The wizard will guide you through the rest of installation till the driver is installed. Run Agilent IO libraries suite, the analyzer will be detected automatically.
Programmer’s Guide 5
1 Getting Started
Connecting the Analyzer via the LAN Port
No extra driver is required to connect the analyzer via the LAN port to a PC. All you need is the Agilent IO libraries suite in the Product CD Help Kit. Or refer to the link below to download the IO libraries suite:
http://www.agilent.com/find/iolib
Please refer to the following steps to finish the connection:
1 Switch on the analyzer.
2 Connect the spectrum analyzer to a PC with a LAN cable.
3 Press [SYS] > {Setting} > {IP Admin} > {IP address} to set IP address
for the instrument. For example, set “10.0.0.5” as the IP address for the instrument. Press {Apply} as
4 Run Agilent Connection Expert in IO libraries suite. Right-click on the
LAN (TCPIP0) icon, select “Add Instrument’ in the pop-up menu. The “Add LAN Instruments” window displays for the IP configuration.
5 Select “Add Address”, check “Use IP Address” in the window and input
the IP address as the instrument IP address you set before.
6 Programmer’s Guide
Getting Started 1
6 Press “Test Connection” to check the LAN connection. The figure
below indicates that the connection is ready.
7 Check “*IDN query” and press “Identify Instrument”. The instrument
information shows the firmware revision and product number. The analyzer is ready for your further programming.
Programmer’s Guide 7
1 Getting Started
8 Programmer’s Guide
Agilent N9342C/43C/44C Handheld Spectrum Analyzer Programmer’s Guide
2 Programming Fundamentals
Overview 10
Command Categories 12
Command Syntax 13
Creating Valid Commands 15
Program and Response Messages 16
Parameters in Commands 17
The purpose of this chapter is to serve as a reminder of SCPI (Standard Commands for Programmable Instruments) fundamentals to those who have previous experience in programming SCPI. This chapter is not intended to teach you everything about the SCPI programming language. If you are using an optional programming compatibility modes, you should refer to the manual that came with the option.
9
2 Programming Fundamentals

Overview

SCPI Language Basics
This section is not intended to teach you everything about the SCPI (Standard Commands for Programmable Instruments) programming language. The SCPI Consortium or IEEE provides that level of detailed information.
Programming with SCPI requires knowledge of:
Computer programming languages, such as C, C++, and MicrosoftVisual Basic.
The language of your instrument. The analyzer employs SCPI as its programming language.
The semantic requirements of your controller’s language determine how the programming commands and responses are handled in your application program.
SCPI is an ASCII-based instrument command language designed for test and measurement instruments, with the goal of reducing automatic test equipment (ATE) program development time.
SCPI accomplishes this goal by providing a consistent programming environment for instrument control and data usage. This consistent programming environment is achieved by the use of defined program messages, instrument responses, and data formats across all SCPI instruments.
By providing a consistent programming environment, replacing one SCPI instrument with another SCPI instrument in a system will usually require less effort than with non-SCPI instrument.
SCPI is not a standard which completely provides for interchangeable instrumentation. SCPI helps move toward interchangeability by defining instrument commands and responses, but not functionality, accuracy, resolution, etc.
10 Programmer’s Guide
Common Terms used in this Book
Programming Fundamentals 2
Te rm s
Controller
Instrument
Command
Query
Description
Any computer used to communicate with an instrument. A controller can be a personal computer (PC), a minicomputer, or a plug-in card in a card cage. Some intelligent instruments can also function as controllers.
Any device that implements SCPI. Most instruments are electronic measurement or stimulus devices, but this is not a requirement. Similarly, most instruments use a GPIB or RS-232 or USB interface for communication. The same concepts apply regardless of the instrument function or the type of interface used.
An instruction. You combine commands to form messages that control instruments to complete a specified task. In general, a command consists of mnemonics (keywords), parameters and punctuation.
A special type of command. Queries instruct the instrument to make response data available to the controller. Query keywords always end with a question mark, ? .
The SCPI Consortium or IEEE can provide detailed information on the subject of SCPI programming. Refer to IEEE Standard 488.1-1987,
IEEE Standard Digital Interface for Programmable Instrumentation. New York, NY, 1987, or to IEEE Standard 488.2-1992, IEEE Standard Codes, Formats, Protocols and Common Commands for Use with ANSI/IEEE Std 488.1-1987. New York, NY, 1992.
Programmer’s Guide 11
2 Programming Fundamentals

Command Categories

The SCPI command falls into two categories:
Subsystem commands that simulate front panel keystrokes
Common commands that are unique and have no front panel
equivalent
Use a computer to control the instrument (but operate the power/standby switch manually). Computer programming procedures for the instrument involve selecting a programming statement and then adding the specified programming codes to that statement to achieve the desired operating conditions.
For more specific command instructions, please refer to Chapter 5, “Command Reference,” starting on page 49.
12 Programmer’s Guide

Command Syntax

Programming Fundamentals 2
A command consists of mnemonics (keywords), parameters and punctuation. Before you start to program your signal generator, familiarize yourself with the standard notation of each of them.
Command Mnemonics (keywords)
Punctuation A vertical bar "|" dictates a choice of one element from a list. For example:
Separator A colon ":" seperates keywords of different levels. The colon before the
Many commands have both a long and a short form: use either one. (a combination of the two is not allowed). Consider the :FREQuency command for example:
Short form :FREQ
Long form :FREQUENCY
SCPI is not case sensitive, so fREquEncy is just as valid as FREQUENCY, but FREQ and FREQUENCY are the only valid forms of the FREQuency command.
In this documentation, upper case letters indicate the short form of the keyword. The lower case letters indicate the long form of the keyword.
<A>|<B> indicates that either A or B can be selected, but not both.
Square brackets "[ ]" indicates that the enclosed items are optional.
Angle brackets "< >" indicates a variable items to be entered to represent
user choices.
A question mark "?" after a subsystem command indicates that the command is a query. The returned information, <value> varies in format according to the type of the field.
root keyword is usually omitted.
A space separates a keyword and a parameter, as well as a parameter and a unit.
Programmer’s Guide 13
2 Programming Fundamentals
NOTE
Command Statement Rules Overview
Command Example
Besides the standard notation of SCPI described above, please remember the following rules in programming:
command statements read from left to right
use either long form or short form of keywords, but do not use both
no separating space between the keywords, only use a colon to
separate keywords of different levels
always separating a keyword from a variable with a space
always separating a variable from its unit with a space (if variable has a unit).
A typical command is made up of key words set off by colons. The key words are followed by parameters that can be followed by optional units.
Example 1 :TRIGger:SEQuence:VIDeo:LEVel 2.5V
The instrument does not distinguish between upper and lower case letters. In the documentation, upper case letters indicate the short form of the key word. The upper and lower case letters, together, indicate the long form of the key word. Either form may be used in the command.
Example 2 :Trig:Seq:Vid:Lev 2.5V is the same as
:trigger:sequence:video:level 2.5V.
The command :TRIGG:Sequence:Video:Level 2.5V is not valid because command.
14 Programmer’s Guide
:TRIGG is neither the long, nor the short form of the

Creating Valid Commands

Command Syntax Sample Valid Commands
Programming Fundamentals 2
Commands are not case sensitive and there are often many different ways of writing a particular command. These are examples of valid commands for a given command syntax:
[:SENSe]:BANDwidth[:RESolution]<freq>
:CALCulate:MARKer[1]|2|3|4:Y? The last command below returns different results than
[:SENSe]:DETector[:FUNCtion] NEGative|POSitive|SAMPle
:INITiate:CONTinuous OFF|ON|0|1 The sample commands below are identical.
The following sample commands are all identical. They will all cause the same result.
:Sense:Band:Res 1700 :BANDWIDTH:RESOLUTION 1.7e3 :sens:band 1.7KHZ :SENS:band 1.7E3Hz :band 1.7kHz :bandwidth:RES 1.7e3Hz
the commands above it. The number 3 in the command causes this. See the command description for more information.
:CALC:MARK:Y? :calc:mark:y? :CALC:MARK2:Y?
DET:FUNC NEG :Sense:Detector:Function Sample
:INIT:CONT ON :init:continuous 1
Programmer’s Guide 15
2 Programming Fundamentals

Program and Response Messages

To understand how your instrument and controller communicate using SCPI, you must understand the concepts of program and response messages.
Program Messages
Program messages are the formatted data sent from the controller to the instrument. Conversely, response messages are formatted data sent from the instrument to the controller. Program messages contain one or more commands, and response messages contain one or more responses.
Response Messages
The controller may send commands at any time, but the instrument sends responses only when query commands is received. All query mnemonics end with a question mark. Queries return either measured values or internal instrument settings.
Forgiving Listening and Precise Talking
SCPI uses the concept of forgiving listening and precise talking outlined in IEEE 488.2.
Forgiving listening means that instruments are very flexible in accepting various command and parameter formats. For example, the spectrum analyzer accepts either
:FREQuency:CENTer:STEP:AUTO 1
Precise talking means that the response format for a particular query is always the same. For example, if you query RF output state when it is on (using is always 1, regardless of if you previously sent
:FREQuency:CENTer:STEP:AUTO?), the response
:FREQuency:CENTer:STEP:AUTO ON
:FREQuency:CENTer:STEP:AUTO 1.
16 Programmer’s Guide
:FREQuency:CENTer:STEP:AUTO ON or
or

Parameters in Commands

There are four basic types of parameters: boolean, key words, variables and arbitrary block program data.
Boolean
The expression OFF|ON|0|1 is a two state boolean-type parameter. The numeric value 0 is equivalent to OFF. Any numeric value other than 0 is equivalent to ON. The numeric values of 0 or 1 are commonly used in the command instead of OFF or ON, and queries of the parameter always return a numeric value of 0 or 1.
Key Word
The parameter key words that are allowed for a particular command are defined in the command description and are separated with a vertical slash.
Programming Fundamentals 2
Units
Numerical variables may include units. The valid units for a command depends on the variable type being used. See the following variable descriptions. If no units are sent, the indicated default units will be used. Units can follow the numerical value with, or without, a space.
Variable
A variable can be entered in exponential format as well as standard numeric format. The appropriate variable range and its optional units are defined in the command description.
Programmer’s Guide 17
2 Programming Fundamentals
Variable Parameters
<ampl>,
<rel_ampl>
<file_name> A file name parameter is the name of your file, is not used in the SCPI
<freq> A frequency parameter is a positive rational number followed by
<integer> There are no units associated with an integer parameter.
<number> A number parameter is a member of the set of positive or negative
<percent> A percent parameter is a rational number between 0 and 100, with no
<rel_power> A relative power parameter is a positive rational number followed by
<string> A string parameter includes a series of alpha numeric characters.
<time> A time parameter is a rational number followed by optional units. The
The <ampl> (amplitude) parameter and the <rel_ampl> (relative amplitude) parameter consist of a rational number followed by optional units. Acceptable units for <ampl> include: V, mV, V, dBm, dBmV, dBuV, Watts, W. <rel_ampl> units are given in dB.
command string.
optional units. The default unit is Hz. Acceptable units include: Hz, kHz, MHz, GHz.
intriguers and including zero. Fractional numbers are included in the number parameter. There are no units associated with a number parameter.
units.
optional units. The default units are dB. Acceptable units are dB only.
default units are seconds. Acceptable units include: S, MS, US.
18 Programmer’s Guide
Agilent N9342C/43C/44C Handheld Spectrum Analyzer Programmer’s Guide
3 Status Registers
Overview 20
How to use the Status Registers 23
Status Register System 25
This chapter contains a comprehensive description of status registers explaining what status registers are and how to use them so you can use a program to monitor the instrument. Information about all of the bits of the status registers is also provided.
19
3 Status Registers

Overview

What are Status Registers
When you are programming the instrument you may need to monitor instrument status to check for error conditions or monitor changes. You need to determine the state of certain instrument events/conditions by programming the status register system.
IEEE common commands (those beginning with *) access the higher-level summary registers. To access the information from specific registers you would use the STATus commands. The STATus subsystem remote commands set and query the status hardware registers. This system of registers monitors various events and conditions in the instrument. Software written to control the instrument may need to monitor some of these events and conditions.
The status system contains multiple registers that are arranged in a hierarchical order. The lower-level status registers propagate their data to the higher-level registers in the data structures by means of summary bits. The status byte register is at the top of the hierarchy and contains general status information for the instrument’s events and conditions. All other individual registers are used to determine the specific events or conditions.
Each register set is made up of five registers:
Condition
Register
Positive
Tra ns it io n
Register
Negative
Tra ns it io n
Register
20 Programmer’s Guide
It reports the real-time state of the signals monitored by this register set. There is no latching or buffering for a condition register.
This filter register controls which signals will set a bit in the event register when the signal makes a low to high transition (when the condition bit changes from 0 to 1).
This filter register controls which signals will set a bit in the event register when the signal makes a high to low transition (when the condition bit changes from 1 to 0).
Status Registers 3
Event Register It latches any signal state changes, in the way specified by the filter
registers. Bits in the event register are never cleared by signal state changes. Event registers are cleared when read. They are also cleared by *CLS and by presetting the instrument.
Event Enable
Register
It controls which of the bits, being set in the event register, will be summarized as a single output for the register set. Summary bits are then used by the next higher register.
Access the status registers
There are two different methods to access the status registers:
Common Commands Accesses and Controls
Status Subsystem Commands
Programmer’s Guide 21
3 Status Registers
What are Status Register SCPI Commands
Most monitoring of the instrument conditions is done at the highest level using the IEEE common commands indicated below. Complete command descriptions are available in the IEEE commands section at the beginning of the language reference. Individual status registers can be set and queried using the commands in the STATus subsystem of the language reference.
*CLS (clear status) clears the status byte by emptying the error queue and clearing all the event registers.
*ESE, *ESE? (event status enable) sets and queries the bits in the enable register part of the standard event status register.
*ESR? (event status register) queries and clears the event register part of the standard event status register.
*SRE,*SRE? (service request enable) sets and queries the value of the service request enable register.
*STB? (status byte) queries the value of the status byte register without erasing its contents.
22 Programmer’s Guide

How to use the Status Registers

A program often needs to detect and manage error conditions or changes in instrument status. The polling method for you to programmatically access the information in status registers.
In the polling method, the instrument has a passive role. It only tells the controller that conditions have changed when the controller asks the right question. In the SRQ method, the instrument takes a more active role. It tells the controller when there has been a condition change without the controller asking. Either method allows you to monitor one or more conditions.
The polling method works well if you do not need to know about changes the moment they occur. To detect a change using the polling method, the program must repeatedly read the registers.
To monitor a condition:
— Determine which register contains the bit that reports the condition. — Send the unique SCPI query that reads that register. — Examine the bit to see if the condition has changed. You can monitor conditions in different ways.
Check the instrument hardware and firmware status.
Do this by querying the condition registers which continuously monitor status. These registers represent the current state of the instrument. Bits in a condition register are updated in real time. When the condition monitored by a particular bit becomes true, the bit is set to 1. When the condition becomes false, the bit is reset to 0.
Monitor a particular condition (bit).
You can enable a particular bit(s), using the event enable register. The instrument will then monitor that particular condition(s). If the bit becomes true (0 to 1 transition) in the event register, it will stay set until the event register is cleared. Querying the event register allows you to detect that this condition occurred even if the condition no longer exists. The event register can only be cleared by querying it or sending the *CLS command.
Monitor a particular type of change in a condition (bit).
Status Registers 3
Programmer’s Guide 23
3 Status Registers
Status Register Examples
— The transition registers are preset to register if the condition goes from 0 to 1 (false to true, or a positive transition).
— This can be changed so the selected condition is detected if the bit goes from 1 to 0 (true to false, or a negative transition).
— It can also be set for both types of transitions occurring.
— Or it can be set for neither transition. If both transition registers are set to 0 for a particular bit position, that bit will not be set in the event register for either type of change.
Each bit in a register is represented by a numerical value based on its location. See figure below. This number is sent with the command to enable a particular bit. If you want to enable more than one bit, you would send the sum of all the bits that you want to monitor.
Example
1 To enable bit 0 and bit 6 of standard event status register, you would
send the command *ESE 65 because 1 + 64 = 65.
2 The results of a query are evaluated in a similar way. If the *STB?
command returns a decimal value of 140, (140 = 128 + 8 + 4) then bit 7 is true, bit 3 is true and bit 2 is true.
24 Programmer’s Guide

Status Register System

Event Enable Reg
.
7654321
0
&
&
&
&
&
&
&
+
0 1 2 3 4 5 6 7
Status Byte Register (*STB?)
Unused Unused
Error/Event Queue Summary
Unused
Message Available (MAV)
Std. Event Status Sum
Unused
Reserved
+
0 1 2 3 4 5 6 7
Standard Event Status Register
Unused Unused
Query Error
Dev. Dep. Error
Unused
Command Error
Reserved
Power On
Service Request Enable Register
(*ESE,*ESE?,*ESR?,*)
(*SRE,*SRE?)
The hardware status registers are combined to form the instrument status system. Specific status bits are assigned to monitor various aspects of the instrument operation and status. See the following diagram of the status system for information about the bit assignments and status register interconnections.
Figure 1 Agilent N9342C/43C/44C Status Register System
Status Registers 3
Programmer’s Guide 25
Setting and Querying the Status Register
Each bit in a register is represented by a numerical value based on its location. This number is sent with the command to enable a particular bit. To enable more than one bit, send the sum of all of the bits involved.
For example, to enable bit 0 and bit 6 of the standard event status register, you would send the command *ESE 65 (1 + 64).
The results of a query are evaluated in a similar way. If the *STB? command returns a decimal value of 140, (140 = 128 + 8 + 4) then bit 7 is true, bit 3 is true, and bit 2 is true.
3 Status Registers
0
1
2
3
4
5
6
7
Status Byte Register
Unused
Unused
Error/Event Queue Summary Bit
Unused
Message Available (MAV)
Standard Event Summary Bit
Unused
Operation Status Summary Bit
&
&
&
&
&
&
&
+
0 1 2 3 4 5 6 7
Service Request Enable Register
The Status Byte Register
26 Programmer’s Guide
The RQS bit is read and reset by a serial poll. The same bit position (MSS) is read, non-destructively by the *STB? command. If you serial poll bit 6 it is read as RQS, but if you send *STB it reads bit 6 as MSS. For more information refer to IEEE 488.2 standards, section 11.
Status Registers 3
The status byte register contains the following bits:
Bit Description
0,1 Unused: These bits are always set to 0.
2 Error/Event Queue Summary Bit: A 1 in this bit position indicates
that the SCPI error queue is not empty. The SCPI error queue contains at least one error message.
3 Questionable Status Summary Bit: A 1 in this bit position
indicates that the questionable status summary bit has been set. The questionable status event register can then be read to determine the specific condition that caused this bit to be set.
4 Message Available (MAV): A 1 in this bit position indicates that the
analyzer has data ready in the output queue. There are no lower status groups that provide input to this bit.
5 Standard Event Status Summary Bit: A 1 in this bit position
indicates that the standard event status summary bit has been set. The standard event status register can then be read to determine the specific event that caused this bit to be set.
6
Request Service (RQS) Summery Bit: A 1 in this bit position indi-
cates that the analyzer has at least one reason to report a status change. This bit is also called the master summary status bit (MSS).
7
Operation Status Summary Bit: A 1 in this bit position indicates
that the operation status summary bit has been set. The operation status event register can then be read to determine the specific event that caused this bit to be set.
To query the status byte register, send the *STB command. The response will be the decimal sum of the bits that are set to 1. For example, if bit number 7 and bit number 3 are set to 1, the decimal sum of the 2 bits is 128 plus 8. So the decimal value 136 is returned.
In addition to the status byte register, the status byte group also contains the service request enable register. The status byte service request enable register lets you choose which bits in the Status Byte Register will trigger a service request.
Programmer’s Guide 27
3 Status Registers
Operation Complete
Request Bus Control
Query Error
Device Dependent Error
Execution Error
Command Error
User Request
Power On
&
&
&
&
&
&
&
+
0 1 2 3 4 5 6 7
Event Enable Register
&
0
1 2
3 4 5 6 7
To Status Byte Register bit #5
Standard Event Status Register
Standard Event Status Register
The standard event status register is used to determine the specific event that sets bit 5 in the status byte register. The standard event status register does not have negative and positive transition registers, nor a condition register. Use the IEEE common commands at the beginning of
“Command Reference” on page 49 to access the register.
To query the standard event status register, send the *ESR command. The response will be the decimal sum of the bits which are set to 1. For example, if bit number 7 and bit number 3 are set to 1, the decimal sum of the 2 bits is 128 plus 8. So the decimal value 136 is returned.
See “Setting and Querying the Status Register” on page 25 for more information.
Figure 2 Standard Event Status Register Diagram
28 Programmer’s Guide
Status Registers 3
The standard event status register contains following bits:
Bit Description
0 Unused
1 Request Bus Control: This bit is always set to 0. (The analyzer does not
request control.)
2
Query Error: A 1 in this bit position indicates that a query error has
occurred. Query errors have SCPI error numbers from 499 to 400.
3
Device Dependent Error: A 1 in this bit position indicates that a device
dependent error has occurred. Device dependent errors have SCPI error numbers from –399 to –300 and 1 to 32767.
4 Execution Error: A 1 in this bit position indicates that an execution error
has occurred. Execution errors have SCPI error numbers from –299 to –200.
5
Command Error: A 1 in this bit position indicates that a command error has
occurred. Command errors have SCPI error numbers from –199 to –100.
6
User Request Key (Local): A 1 in this bit position indicates that the
[Preset/System] (Local) key has been pressed. This is true even if the analyzer is in local lockout mode.
7
Power On: A 1 in this bit position indicates that the analyzer has been turned
off and then on.
The standard event status register is used to determine the specific event that set bit 5 in the status byte register. To query the standard event status register, send the command *ESR?. The response will be the decimal sum of the bits which are enabled (set to 1). For example, if bit number 7 and bit number 3 are enabled, the decimal sum of the 2 bits is 128 plus 8. So the decimal value 136 is returned.
In addition to the standard event status register, the standard event status group also contains a standard event status enable register. This register lets you choose which bits in the standard event status register will set the summary bit (bit 5 of the status byte register) to 1. Send the *ESE <integer> command where <integer> is the sum of the decimal values of the bits you want to enable. For example, to enable bit 7 and bit 6 so that whenever either of those bits is set to 1, the standard event status summary bit of the status byte register will be set to 1, send the
Programmer’s Guide 29
3 Status Registers
command *ESE 192 (128 + 64). The command *ESE? returns the decimal value of the sum of the bits previously enabled with the *ESE <integer> command.
The standard event status enable register presets to zeros (0).
Figure 3 Standard Event Status Event Enable Register
30 Programmer’s Guide
Agilent N9342C/43C/44C Handheld Spectrum Analyzer Programmer’s Guide
4b Programming Example
Overview 32
Programming in C using the VTL 33
Checking USB Connection 39
Using C with Marker Peak Search and Peak Excursion 40
Using Marker Delta Mode and Marker Minimum Search 44
Measuring Phase Noise 48
This chapter provides some programming conventions and examples for your further reference.
31
4 Programming Example
NOTE

Overview

The programming examples in this section keep to the following 3 conventions:
The programming examples were written for use on an compatible PC.
The programming examples use USB interface.
The programming examples are written in C programming language
and SCPI programming commands, using Agilent VISA transition library (Agilent VTL).
The Agilent VTL is installed when you installed the Agilent IO libraries suite.
The Agilent IO libraries suite contains the latest Agilent VTL and is available at:
http://www.agilent.com/find/iolib
Agilent Technologies provides programming examples for illustration only. All sample programs assume that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures.
You have a royalty-free right to use, modify, reproduce and distribute the sample application files in any way you find useful, provided that you agree that Agilent has no warranty, obligations, or liability for any sample application files.
32 Programmer’s Guide

Programming in C using the VTL

This section includes some basic information about programming in the C language using Agilent VISA transition library (VTL). Note that some of this information may not be relevant to your particular application. For example, if you are not using VXI instruments, the VXI references will not be relevant.
Typical Example Program Contents
The following table summaries the VTL function calls used in the example programs.
visa.h This file is included at the beginning of the each file to provide the function
prototypes and constants defined by VTL. For C and C++ programs, you must include the visa.h header file at the beginning of every file that contains VISA function calls: #include “visa.h”
ViSession The ViSession is a VTL data type. Each object that will establish a communication
channel must be defined as ViSession. Sessions must firstly be opened on the default resource manager, and then for each resource you will be using.
Programming Example 4
viOpenDefaultRM You must first open a session with the default resource manager with the
viOpenDefaultRM function, and then for each resource you will be using. This
function will initialize the default resource manager and return a pointer to that resource manager session.
viOpenDefaultRM(&sesn)
viOpen This function establishes a communication channel with the device specified. A
session identifier that can be used with other VTL functions is returned. This call must be made for each device you will be using.
viOpenDefaultRM(&sesn) viOpen(sesn, rsrcName, accessMode, timeout, &vi)
viPrintf viScanf
viWrite This function synchronously sends the data pointed to by buf to the device specified
These are the VTL formatted I/O functions that are patterned after those used in the C programming language. The viPrintf call sends the SCPI commands to the analyzer. The viPrintf call can also be used to query the analyzer. The viScanf call is then used to read the results.
by vi. Only one synchronous write operation van occur at any one time.
viWrite(vi, buf, count, &retCount)
Programmer’s Guide 33
4 Programming Example
viRead This function synchronously reads raw data from the session specified by the vi
viClose This function must be used to close each session. When you close a device session, all
Example Program
parameter and stores the result in location where buf is pointing. Only one synchronous read operation can occur at any one time.
viRead(vi, buf, count, &retCount)
data structures that had been allocated for the session will be set free. If you close the default resource manager session, all sessions opened using that resource manager session will be closed.
viClose(vi); viClose(defaultRM)
This example program queries a USB device for an identification string and prints the results. Note that you must change the address if something other than the default USB address value is required.
/*idn.c - program filename */ #include "visa.h" #include <stdio.h> void main () { char buf[300] ViSession viN9342C ViStatus viSatus; ViSession defaultRM; /*Open session to USB device */ viOpenDefaultRM(&defaultRM); viStatus=viOpen(defaultRM,"USB0::2391::8472::000
0000000::0::INSTR",VI_NULL,VI_NULL,&viN9342C); /*Initialize device */ viPrintf(viN9342C, "*RST\n"); /*Send an *IDN? string to the device */ printf(viN9342C, "*IDN?\n"); /*Read results */
34 Programmer’s Guide
viScanf(viN9342C, "%t", &buf); /*Print results */ printf("Instrument identification string: %s\n",
buf); /* Close the sessions */ viClose(viN9342C); viClose(defaultRM); }
Including the VISA Declarations File
For C and C++ programs, you must include the visa.h header file at the beginning of every file that contains VTL function calls:
#include “visa.h”
This header file contains the VISA function prototypes and the definitions for all VISA constants and error codes. The visa.h header file includes the visatype.h header file.
The visatype.h header file defines most of the VISA types. The VISA types are used throughout VTL to specify data types used in the functions. For example, the viOpenDefaultRM function requires a pointer to a parameter of type ViSession. If you find ViSession in the visatype.h header file, you will find that ViSession is eventually typed as an unsigned long.
Programming Example 4
Opening a Session
A session is a channel of communication. Sessions must first be opened on the default resource manager, and then for each device you will be using. The following is a summary of sessions that can be opened:
A resource manager session is used to initialize the VISA system. It is a parent session that knows about all the opened sessions. A resource manager session must be opened before any other session can be opened.
Programmer’s Guide 35
4 Programming Example
NOTE
Device Sessions
A device session is used to communicate with a device on an interface. A device session must be opened for each device you will be using. When you use a device session you can communicate without worrying about the type of interface to which it is connected. This insulation makes applications more robust and portable across interfaces. Typically a device is an instrument, but could be a computer, a plotter, or a printer.
All devices that you will be using need to be connected and in working condition prior to the first VTL function call (viOpenDefaultRM). The system is configured only on the first viOpenDefaultRM per process. Therefore, if viOpenDefaultRM is called without devices connected and then called again when devices are connected, the devices will not be recognized. You must close ALL resource manager sessions and re-open with all devices connected and in working condition.
There are two parts to opening a communications session with a specific device. First you must open a session to the default resource manager with the viOpenDefaultRM function. The first call to this function initializes the default resource manager and returns a session to that resource manager session. You only need to open the default manager session once. However, subsequent calls to viOpenDefaultRM returns a session to a unique session to the same default resource manager resource.
Next, you open a session with a specific device with the viOpen function. This function uses the session returned from viOpenDefaultRM and returns its own session to identify the device session. The following shows the function syntax:
viOpenDefaultRM (sesn);
viOpen (sesn, rsrcName, accessMode, timeout, vi);
The session returned from viOpenDefaultRM must be used in the
sesn parameter of the viOpen function. The viOpen function then uses that session and the device address specified in the (resource name) parameter to open a device session. The vi parameter in viOpen returns a session identifier that can be used with other VTL functions.
36 Programmer’s Guide
Programming Example 4
Your program may have several sessions open at the same time by creating multiple session identifiers by calling the viOpen function multiple times.
The following summarizes the parameters in the previous function calls:
sesn
This is a session returned from the viOpenDefaultRM function that identifies the resource manager session.
rsrcName This is a unique symbolic name of the device (device address).
accessMode This parameter is not used for VTL. Use VI_NULL.
timeout This parameter is not used for VTL. Use VI_NULL.
vi This is a pointer to the session identifier for this particular device session. This
pointer will be used to identify this device session when using other VTL functions.
Programmer’s Guide 37
4 Programming Example
Addressing a Session
As seen in the previous section, the rsrcName parameter in the viOpen function is used to identify a specific device. This parameter is made up of the VTL interface name and the device address. The interface name is determined when you run the VTL Configuration Utility. This name is usually the interface type followed by a number. The following table illustrates the format of the rsrcName for the different interface types:
The following describes the parameters used above:
board
VXI logical address This is the logical address of the VXI instrument.
primary address This is the primary address of the USB device.
secondary address This optional parameter is the secondary address of the USB device. If no
INSTR This is an optional parameter that indicates that you are communicating with a
This optional parameter is used if you have more than one interface of the same type. The default value for board is 0.
secondary address is specified, none is assumed.
resource that is of type INSTR, meaning instrument.
Closing a Session
The viClose function must be used to close each session. You can close the specific device session, which will free all data structures that had been allocated for the session. If you close the default resource manager session, all sessions opened using that resource manager will be closed.
Since system resources are also used when searching for resources (viFindRsrc) or waiting for events (viWaitOnEvent), the viClose function needs to be called to free up find lists and event contexts.
38 Programmer’s Guide

Checking the USB Connection

Usually, using “*IDN?” verifies the data transferring between the controller PC and the instrument.
****************************************************
#include "visa.h" #include <stdio.h>
#define BufferSize 128
static ViStatus status; static ViSession defaultRM; static ViSession inst_N9342C; static ViUInt32 rcount; static unsigned char buffer[BufferSize];
int main(void)
{
/* Connect N9342C and read its "IDN". */
status = viOpenDefaultRM (&defaultRM);
status = viOpen (defaultRM, "USB0::2391::8472::0000000000::0::INSTR", VI_NULL, VI_NULL, &inst_N9342C);
if (status != VI_SUCCESS)
return -1; //failed to connect N9342C/
/* Read "IDN" from N9342C" */
status = viWrite (inst_N9342C, "*RST\n", StringLength("*RST\n"), &rcount);
status = viWrite (inst_N9342C, "*IDN?\n", StringLength("*IDN?\n"), &rcount);
status = viRead (inst_N9342C, buffer, BufferSize, &rcount);
/* Close connection to N9342C. */
status = viClose (inst_N9342C);
status = viClose (defaultRM); return 1;
}
Programming Example 4
Programmer’s Guide 39
4 Programming Example

Using C with Marker Peak Search and Peak Excursion

/************************************************************/ /* Using Marker Peak Search and Peak Excursion */ /* */ /* This example is for the N9342C Handheld Spectrum Analyzer. */ /* */ /* This C programming example does the following. */ /* The SCPI instrument commands used are given as reference. */ /* */ /* - Opens a USB session */ /* - Clears the Analyzer */ /* *CLS */ /* - Resets the Analyzer */ /* *RST */ /* - Sets the analyzer center frequency, span and units */ /* SENS:FREQ:CENT freq */ /* SENS:FREQ:SPAN freq */ /* UNIT:POW DBM */ /* - Set the input port to the 50 MHz amplitude reference */ /* CAL:SOUR:STAT ON */ /* - Set the analyzer to single sweep mode */ /* INIT:CONT 0 */ /* - Prompt the user for peak excursion and set them */ /* CALC:MARK:PEAK:EXC dB */ /* - Set the peak threshold to -90 dBm */ /* CALC:MARK:PEAK:THR:STAT ON */ /* CALC:MARK:PEAK:THR <ampl> */ /* - Trigger a sweep and delay for sweep to complete */ /* INIT:IMM */ /* - Set the marker to the maximum peak */ /* CALC:MARK1:MAX */ /* - Query and read the marker frequency and amplitude */ /* CALC:MARK:X? */ /* CALC:MARK:Y? */ /* - Close the session */ /************************************************************/
40 Programmer’s Guide
Programming Example 4
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <string.h> #include "visa.h"
ViSession defaultRM, viN9342C; ViStatus errStatus; ViChar cIdBuff[256]= {0}; char cEnter = 0; int iResult = 0;
/*Set the input port to 50MHz amplitude reference*/ void Route50MHzSignal() {
viQueryf(viN9342C, "*IDN?\n", "%t", &cIdBuff); /* prompt the user*/ /* to connect the amplitude reference output to the input*/ printf ("Connect CAL OUT to the RF IN \n");
printf ("......Press Return to continue \n");
scanf( "%c",&cEnter); /*Externally route the 50MHz Signal*/ viPrintf(viN9342C,"CAL:SOUR:STAT ON \n");
} void main() { /*Program Variables*/ ViStatus viStatus = 0; double dMarkerFreq = 0; double dMarkerAmpl = 0; float fPeakExcursion =0;
Programmer’s Guide 41
4 Programming Example
/*Open a USB session.*/ viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM,"USB0::2391::8472::0000000000::0::INSTR",V I_NULL,VI_NULL,&viN9342C);
if(viStatus) { printf("Could not open a session to USB device\n"); exit(0); } /*Clear the instrument*/ viClear(viN9342C);
/*Reset the instrument*/ viPrintf(viN9342C,"*RST\n");
/*Set Y-Axis units to dBm*/ viPrintf(viN9342C,"UNIT:POW DBM\n");
/*Set the analyzer center frequency to 50MHZ*/ viPrintf(viN9342C,"SENS:FREQ:CENT 50e6\n");
/*Set the analyzer span to 50MHZ*/ viPrintf(viN9342C,"SENS:FREQ:SPAN 50e6\n");
/*Display the program heading */ printf("\n\t\t Marker Program \n\n" );
/* Check for the instrument model number and route the 50MHz signal accordingly*/
Route50MHzSignal();
/*Set analyzer to single sweep mode*/ viPrintf(viN9342C,"INIT:CONT 0 \n ");
/*User enters the peak excursion value*/ printf("\t Enter PEAK EXCURSION in dB: "); scanf( "%f",&fPeakExcursion);
42 Programmer’s Guide
Programming Example 4
/*Set the peak excursion*/ viPrintf(viN9342C,"CALC:MARK:PEAK:EXC %1fDB \n",fPeakExcursion);
/*Set the peak thresold */ viPrintf(viN9342C,"CALC:MARK:PEAK:THR -90 \n");
/*Trigger a sweep and wait for completion*/ viPrintf(viN9342C,"INIT:IMM \n");
/*Set the marker to the maximum peak*/ viPrintf(viN9342C,"CALC:MARK:MAX \n");
/*Query and read the marker frequency*/ viQueryf(viN9342C,"CALC:MARK:X? \n","%lf",&dMarkerFreq); printf("\n\t RESULT: Marker Frequency is: %lf MHZ \n\
n",dMarkerFreq/10e5);
/*Query and read the marker amplitude*/ viQueryf(viN9342C,"CALC:MARK:Y?\n","%lf",&dMarkerAmpl); printf("\t RESULT: Marker Amplitude is: %lf dBm \n\n",dMarkerAmpl);
/*Close the session*/ viClose(viN9342C); viClose(defaultRM); }
Programmer’s Guide 43
4 Programming Example

Using Marker Delta Mode and Marker Minimum Search

/************************************************************/ /* Using Marker Delta Mode and Marker Minimum Search */ /* */ /* This example is for the N9342C Spectrum Analyzers */ /* */ /* This C programming example does the following. */ /* The SCPI instrument commands used are given as reference. */ /* */ /* - Opens a USB session */ /* - Clears the Analyzer */ /* - Resets the Analyzer */ /* *RST */ /* - Set the input port to the 50 MHz amplitude reference */ /* CAL:SOUR:STAT ON */ /* - Set the analyzer to single sweep mode */ /* INIT:CONT 0 */ /* - Prompts the user for the start and stop frequencies */ /* - Sets the start and stop frequencies */ /* SENS:FREQ:START freq */ /* SENS:FREQ:STOP freq */ /* - Trigger a sweep and delay for sweep completion */ /* INIT:IMM */ /* - Set the marker to the maximum peak */ /* CALC:MARK:MAX */ /* - Set the analyzer to activate the delta marker */ /* CALC:MARK:MODE DELT */ /* - Trigger a sweep and delay for sweep completion */ /* INIT:IMM */ /* - Set the marker to the minimum amplitude search mode */ /* CALC:MARK:PEAK:SEAR:MODE MIN */ /* - Set the marker to the minimum peak */ /* CALC:MARK:MAX */ /* - Query and read the marker amplitude */ /* CALC:MARK:Y? */ /* - Close the session */
44 Programmer’s Guide
Programming Example 4
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <string.h> #include "visa.h"
ViSession defaultRM, viN9342C; ViStatus errStatus; ViChar cIdBuff[256] ={0}; char cEnter = 0; int iResult =0;
/*Set the input port to the 50MHz amplitude reference*/ void Route50MHzSignal() {
viQueryf(viN9342C, "*IDN?\n", "%t", &cIdBuff); /* prompt the user*/ /* to connect the amplitude reference output to the
input*/
printf ("Connect CAL OUT to the RF IN \n");
printf ("......Press Return to continue \n");
scanf( "%c",&cEnter); /*Externally route the 50MHz Signal*/ viPrintf(viN9342C,"CAL:SOUR:STAT ON \n");
}
void main() {
/*Program Variable*/ ViStatus viStatus = 0; double dStartFreq =0.0; double dStopFreq =0.0; double dMarkerAmplitude = 0.0;
Programmer’s Guide 45
4 Programming Example
pen(defaultRM,"USB0::2391::8472::9876543210::0::INSTR",VI_NULL,V I_NULL,&viN9342C);
signal accordingly*/
{
/* Open an USB session*/ viStatus=viOpenDefaultRM(&defaultRM); viStatus=viO-
if(viStatus)
printf("Could not open a session to USB device!\n");
exit(0); } /*Clear the instrument*/ viClear(viN9342C);
/*Reset the instrument*/ viPrintf(viN9342C,"*RST\n"); /*Display the program heading */ printf("\n\t\t Marker Delta Program \n\n" );
/*Check for the instrument model number and route the 50MHz
Route50MHzSignal();
/*Set the analyzer to single sweep mode*/ viPrintf(viN9342C,"INIT:CONT 0\n");
/*Prompt the user for the start frequency*/ printf("\t Enter the Start frequency in MHz ");
/*The user enters the start frequency*/ scanf("%lf",&dStartFreq);
/*Prompt the user for the stop frequency*/ printf("\t Enter the Stop frequency in MHz ");
/*The user enters the stop frequency*/ scanf("%lf",&dStopFreq);
46 Programmer’s Guide
Programming Example 4
/*Set the analyzer to the values given by the user*/
//viPrintf(viN9342C,"SENS:FREQ:STAR %lf
//MHZ;:SENS:FREQ:STOP %lf MHZ\n",dStartFreq,dStopFreq);
viPrintf(viN9342C,":SENS:FREQ:STAR %lf MHz\n",dStart-
Freq);
viPrintf(viN9342C,":SENS:FREQ:STOP %lf MHZ\n",dStopFreq);
/*Trigger a sweep, delay for completion*/ viPrintf(viN9342C,"INIT:IMM\n"); //delay(1);
/*Set the marker to the maximum peak*/ viPrintf(viN9342C,"CALC:MARK:MAX\n");
/*Set the analyzer to activate delta marker mode*/ viPrintf(viN9342C,"CALC:MARK:MODE DELT\n");
/*Trigger a sweep, delay for completion* viPrintf(viN9342C,"INIT:IMM\n"); Sleep(1);
/*Set the marker to minimum amplitude Search mode*/ viPrintf(viN9342C,"CALC:MARK:PEAK:SEAR:MODE MIN\n");
/*Set the marker to minimum amplitude*/ viPrintf(viN9342C,"CALC:MARK:MAX\n");
/*Query and read the marker amplitude*/ viQueryf(viN9342C,"CALC:MARK:Y?\n","%lf",&dMarkerAmpli-
tude);
/*print the marker amplitude*/ printf("\n\n\tRESULT: Marker Amplitude Delta =%lf dB\n\
n",dMarkerAmplitude);
/*Close the session*/ viClose(viN9342C);
Programmer’s Guide 47
4 Programming Example
48 Programmer’s Guide
Agilent N9342C/43C/44C Handheld Spectrum Analyzer Programmer’s Guide
5 Command Reference
IEEE Common Commands 50
System Subsystem 54
Memory Subsystem 66
Instrument Subsystem 70
Sense Subsystem 72
Calculate Subsystem 91
Initiate Subsystem 102
Trig ger Sub sy s te m 104
Power Measurement Subsystem 108
Spectrum Monitor Option Subsystem 127
Cable and Antenna Test Option Subsystem 134
Channel Scanner Option Subsystem 148
Demodulation Option Subsystem 165
Power Meter Option Subsystem 201
Tracking Generator Option Subsystem 214
This chapter contains SCPI (Standard Commands for Programmable Instruments) programming commands for the spectrum analyzer core operation.
49
5 Command Reference

IEEE Common Commands

The first few pages of this chapter contain common commands specified in IEEE Standard 488.2-1992, IEEE Standard Codes, Formats,
Protocols and Common Commands for Use with ANSI/IEEE Std.
488.1-1987. New York, NY, 1992.
Following these commands, the Agilent N9342C/43C/44C handheld spectrum analyzers SCPI commands are listed.
Clear Status
*CLS
Clears the status byte register. It does this by emptying the error queue and clearing all bits in all of the event registers. The status byte register summarizes the states of the other registers. generating service requests.
Remark: See *STB?
Standard Event Status Enable
It is also responsible for
*ESE <number> *ESE?
Sets the bits in the standard event status enable register. This register monitors I/O errors and synchronization conditions such as operation complete, request control, query error, device dependent error, execution error, command error and power on. A summary bit is generated on execution of the command.
The query returns the state of the standard event status enable register.
Range: Integer, 0 to 255
Example: *ESE 36 Enables the Standard Event Status Register to monitor query
and command errors (bits 2 and 5).
*ESE? Returns a 36 indicating that the query and command status bits are enabled.
50 Programmer’s Guide
Command Reference 5
Standard Event Status Register Query
*ESR?
Queries and clears the standard event status event register. (This is a destructive read.) The value returned reflects the current state (0/1) of all the bits in the register.
Range: Integer, 0 to 255
Example: *ESR? returns a 1 if there is either a query or command error, otherwise
it returns a zero.
Identification Query
*IDN?
Returns an instrument identification information string. The string will contain the model number, serial number and firmware revision. The response is organized into four fields separated by commas. The field definitions are manufacturer, model, serial number and software version.
Example: *IDN? returns instrument information, such as:
Agilent Technologies, N9342C, 45310116, A.01.02
Key access: SYS > More > Show System
Operation Complete Query
*OPC *OPC?
Sets bit 0 in the standard event status register to “1” when all pending operations have finished.
The query stops any new commands from being processed until the current processing is complete. Then it returns a “1”, and the program continues. This query can be used to synchronize events of other instruments on the external bus.
Returns a “1” if the last processing is complete. Use this query when there’s a need to monitor the command execution status, such as a sweep execution.
Programmer’s Guide 51
5 Command Reference
NOTE
Key access: Preset
Reset
*RST
This command presets the instrument to a factory defined condition that is appropriate for remote programming operation. *RST is equivalent to performing the two commands :SYSTem:PRESet and *CLS. This command always performs a factory preset.
The preset performed by *RST is always a factory preset. That is, the same preset performed by
Tem:PRESet:TYPE
Service Request Enable
*SRE <integer> *SRE?
This command enables the desired bits of the service request enable register.
The query returns the value of the register, indicating which bits are currently enabled. The default value is 255.
Example: *SRE 16
Range: Integer, 0 to 255
:SYSTem:PRESet when :SYS-
is set to DFT
enables bits 4 in the service request enable register.
Status Byte Query
*STB?
Returns the value of the status byte register without erasing its contents.
Range: Integer, 0 to 255
Example: If a 16 is returned, it indicates that bit 5 is set and one of the conditions
monitored in the standard event status register is set.
52 Programmer’s Guide
Self Test Query
*TST?
This query is used by some instruments for a self test.
Range: Integer, 0 to 255
Wait-to-Continue
*WAI
This command causes the instrument to wait until all pending commands are completed before executing any additional commands. There is no query form to the command.
Range: Integer, 0 to 255
Command Reference 5
Programmer’s Guide 53
5 Command Reference

System Subsystem

Range: 0 to 10
Example: :SYSTem:SCReen:BRIGhtness 4
Key access: Shift > System> Screen Setting
Example: :SYSTem:SCReen:BRIGhtness:AUTO ON
This subsystem is used to set the controls and parameters associated with the overall system communication. These functions are not related to instrument performance.
Screen Brightness Setting
:SYSTem:SCReen:BRIGhtness <value> :SYSTem:SCReen:BRIGhtness?
This command sets the screen brightness of the instrument.
Auto Screen Brightness State
:SYSTem:SCReen:BRIGhtness:AUTO OFF|ON|0|1 :SYSTem:SCReen:BRIGhtness:AUTO?
This command turns on/off auto screen brightness state.
Key access: Shift > System> Screen Setting
Set System Time
:SYSTem:TIME <“hhmmss”> :SYSTem:TIME?
Sets the system time of the instrument.
Hour must be an integer 0 to 23.
Minute must be an integer 0 to 59.
Second must be an integer 0 to 59.
Example: :SYSTem:TIME “150233”
Key access: Shift > System> Time/Date > Time
54 Programmer’s Guide
Command Reference 5
Set System Date
:SYSTem:DATE <“yyyymmdd”> :SYSTem:DATE?
Sets the system date of the real-time clock of the instrument. Year is a 4-digit integer. Month is an integer 1 to 12. Day is an integer 1 to 31 (depending on the month)
Example: :SYSTem:DATE “20120912”
Key access: Shift > System > Time/Date > Date
System Time Zone Offset
:SYSTem:TIME:ZONE <value> :SYSTem:TIME:ZONE?
Sets the time zone offset. The offset is set according to the Greenwich Mean Time. Below example sets the time zone offset to 8 hours.
Example: :SYSTem:TIME:ZONE 8
Key access: Shift > System > Time/Date > Time Zone Offset
Run Lasted Time Query
:SYSTem:PON:TIME?
This query returns the time that has elapsed since the analyzer was last turned on.
Language Type
:SYSTem:LANGuage SCHINESE|TCHINESE|ENGLISH|FRENCH|GERMAN|ITALIAN| JAPANESE|KOREAN|PORTUGUESE|RUSSIAN|SPANISH
:SYSTem:LANGuage?
Sets the language type for the soft key menu display. The language type setting is included in the setup(*.SET) file.
Example: :SYSTem:LANGuage SCHINESE
Key access: Shift > System > Language Type
Programmer’s Guide 55
5 Command Reference
Key access: Shift > System > More > Service > Add Option
Key access: Shift > System > System Info > Installed Options > Delete License
Key access: System > System Info > Installed Options
Enable Option
:SYSTem:LKEY <"option">,<"license key">
Use this command to enable the specified option with the license key.
Example: :SYSTem:LKEY "PA3","ABCDEFGH"
Disable Option
:SYSTem:LKEY:DISable <"license key">
Use this command to disable the installed options.
Example: :SYSTem:LKEY: DISable "ABCDEFGH"
Installed Options Query
:SYSTem:OPTions?
This command returns a list of the options that are installed.
System Error
:SYSTem:ERRor[:NEXT]?
Use this command to read the system error information.
Example: :SYSTem:ERRor?
Key access: Shift > System > System Info > Error History
Calibrate Time Base by External Reference Signal
:SYSTem:CALibration:TBASe:EXT
Use this command to calibrate the time base by external signal. Please connect a BNC cable with 10 MHz reference signal to the EXT TRIG IN connector before using this command.
Key access: Shift > System > More > Service > Calibration > Time Base By EXT
56 Programmer’s Guide
Command Reference 5
Calibrate Time Base by GPS
:SYSTem:CALibration:TBASe:GPS
Use this command to calibrate the time base by GPS signal. This command is only available with option GPS installed.
Key access: Shift > System > More > Service > Calibration > Time Base By GPS
Query Time Base Calibration Result
:SYSTem:CALibration:TBASe:FREQuency?
Use this command to query the time base calibration result.
Calibrate Amplitude By External Reference Signal
:SYSTem:CALibration:AMPLitude <dBm>
Use this command to trigger the amplitude calibration, and the <dBm> stands for the amplitude of reference signal. The acceptable amplitude range of reference signal is between –7 dBm and –13 dBm, and the amplitude value used in the SCPI command must be an accurate value.
Example: :SYSTem:CALibration:AMPLitude -10.7
Key access: Shift > System > More > Service > Calibration > Amplitude >
Calibration
Query Amplitude Calibration Result
:SYSTem:CALibration:AMPLitude:STATe?
Use this command to query the amplitude calibration result
BNC Port Input Type Setting
:SYSTem:PORT:EXTInput REF|TRIGger
:SYSTem:PORT:EXTInput?
Toggles the external input between a 10 MHz reference signal and TTL signal.
Key access: Shift > System > More > Port Setting > Ext Input
Programmer’s Guide 57
5 Command Reference
Key access: Shift > System > More > Port Setting > Probe Power
Key access: Shift > System > More > Port Setting > IP Admin > Sys Name
Probe Power
:SYSTem:PORT:PROBe OFF|ON|0|1
:SYSTem:PORT:PROBe?
This command turns on/off the probe power port on the top panel.
IP Config Host Name
:SYSTem:PORT:IP:HNAMe <"string"> :SYSTem:PORT:IP:HNAMe?
Sets a host name for the analyzer in network.
IP Address
:SYSTem:PORT:IP:ADDRess <“xxx.xxx.xxx.xxx”> :SYSTem:PORT:IP:ADDRess?
Sets a host name for the analyzer in network.
Example: :SYSTem:PORT:IP:ADDRess "192.168.0.113"
Key access: Shift > System > More > Port Setting > IP Admin >IP Address
IP Address Assignment
:SYSTem:PORT:IP:ADDRess:TYPE STATIC|DHCP :SYSTem:PORT:IP:ADDRess:TYPE?
Toggles the IP assignment setting between static (manual) and DHCP (dynamic assignment) mode.
Key access: Shift > System > More > Port Setting > IP Admin > IP Address
58 Programmer’s Guide
Command Reference 5
Gateway Setting
:SYSTem:PORT:IP:GWAY <“xxx.xxx.xxx.xxx”>
:SYSTem:PORT:IP:GWAY?
Sets the gateway for the analyzer in the network. The gateway will be fetched automatically if the IP assignment is set to DHCP.
Example: :SYSTem:PORT:IP:GWAY "192.168.0.1"
Key access: Shift > System > More > Port Setting > IP Admin > Gateway
Subnet Mask
:SYSTem:PORT:IP:SMASk <“xxx.xxx.xxx.xxx”> :SYSTem:PORT:IP:SMASk?
Sets the subnet mask according to the PC network settings. The subnet mask will be set automatically if the IP assignment is set to DHCP.
Example: :SYSTem:PORT:IP:SMASk "255.255.255.1"
Key access: Shift > System > More > Port Setting > IP Admin > Subnet Mask
IP Config Apply
:SYSTem:PORT:IP:APPLy
Use this command to apply all the IP settings according to the IP assignment settings. If the IP assignment is set to DHCP, the IP address, gateway, and subnet mask will be set automatically.
Key access: Shift > System > More > Port Setting > IP Admin > Apply
Erase Memory
:SYSTem:SECurity:ERASe
Use this command to erase all the user data saved in internal memory. This command is only available when the option SEC is installed.
Key access: Shift > System > More > Securities > Erase Memory
Programmer’s Guide 59
5 Command Reference
Key access: Preset
Key access: Shift > System > More > Factory Default
System Preset
:SYSTem:PRESet
Use this command to preset the instrument. The preset type is based on the setting of Preset Type: DFT, User or Last.
Factory Default
:SYSTem:FDEFault
Set both the measure and setting parameters to factory preset parameters.
GPS State
:SYSTem:CONGigure:GPS OFF|ON|0|1
:SYSTem:CONFigure:GPS?
Use this command to turn on/off the built-in GPS in the analyzer. This command is only available with the option GPS installed.
Key access: Shift > System > More > GPS On/Off
Sync to GPS Status
:SYSTem:CONFigure:GPS:SYNC OFF|ON|0|1
:SYSTem:CONFigure:GPS:SYNC?
Use this command to turn on/off the synchronization HSA time base to GPS. This command is only available with the option GPS installed, and GPS feature is turned on.
Key access: Shift > System > More > GPS > Sync to GPS On/Off
60 Programmer’s Guide
Command Reference 5
GPS Information
:SYSTem:GPSinfo?
This query returns the GPS information. This command is only available with the option GPS installed.
Key access: Shift > System > More > GPS > GPS Info On/Off
Timed Power On
:SYSTem:TIMed:PON:STATe OFF|ON|0|1 :SYSTem:TIMed:PON:STATe?
Use this command turn on/off the timed power-on function. The analyzer will be turned on in a user-defined time.
Example: :SYSTem:TIMed:PON:STATe ON
Key access: Shift > System > Pwr On/Off Preset > Time Pwr On > Power On
On/Off
Timed Power On Repeat Mode
:SYSTem:TIMed:PON:MODE ONCE|EVERYDAY :SYSTem:TIMed:PON:MODE?
Timed powers on the analyzer just once or repeat everyday.
Example: :SYSTem:TIMed:PON:MODE ONCE
Key access: Shift > System > Pwr On/Off Preset > Time Pwr On > Repeat Mode
Time Power On Time
:SYSTem:TIMed:PON:TIME <“HHMMSS”> :SYSTem:TIMed:PON:TIME?
Sets the power on time, then the analyzer will be turned on automatically.
Example: :SYSTem:TIMed:PON:TIME “122332”
Key access: Shift > System > Pwr On/Off Preset > Time Pwr On > Time
Programmer’s Guide 61
5 Command Reference
Key access: Shift > System > Pwr On/Off Preset > Time Pwr On > Date
Key access: Shift > System > Pwr On/Off Preset > Time Pwr Off > Power Off
Time Power On Date
:SYSTem:TIMed:PON:DATE <“YYYMMDD”> :SYSTem:TIMed:PON:DATE?
Sets the power on date. This commmand is only available when the repeat mode is set to once.
Example: :SYSTem:TIMed:PON:DATE “20120922”
Timed Power Off State
:SYSTem:TIMed:POFF:STATE OFF|ON|0|1 :SYSTem:TIMed:POFF:STATE?
This command turns on/off timed power off status of instrument.
Timed Power Off Repeat Mode
:SYSTem:TIMed:POFF:MODE ONCE|EVERYDAY :SYSTem:TIMed:POFF:MODE?
Use this command to toggle timed power off mode between once and everyday in a user-defined time
Key access: Shift > System > Pwr On/Off Preset > Time Pwr Off > Repeat Mode
Once/Everyday
Time Power Off Time
:SYSTem:TIMed:POFF:TIME <“HHMMSS”> :SYSTem:TIMed:POFF:TIME?
Sets the power off time of the instrument.
Example: :SYSTem:TIMed:POFF:TIME “122332”
Key access: Shift > System > Pwr On/Off Preset > Time Pwr Off > Time
62 Programmer’s Guide
Command Reference 5
Time Power Off Date
:SYSTem:TIMed:POFF:DATE <“YYYMMDD”> :SYSTem:TIMed:POFF:DATE?
Sets the power off date. It’s available when repeat mode is set to once.
Example: :SYSTem:TIMed:POFF:DATE “20120922”
Key access: Shift > System > Pwr On/Off Preset > Time Pwr Off > Date
Power On Type
:SYSTem:PON:TYPE DFT|USER|LAST :SYSTem:PON:TYPE?
Uses this command to preset the analyzer to default, user, or last state.
Example: :SYSTem:PON:TYPE USER
Key access: Shift > System > Pwr On/Off Preset > Pwr On Setting
Preset Type
:SYSTem:PRESet:TYPE DFT|USER|LAST :SYSTem:PRESet:TYPE?
Uses command to set analyzer to power on in default, user, or last state.
Example: :SYSTem:PRESet:TYPE USER
Key access: Shift > System > Pwr On/Off Preset > Preset Type
Save User Preset
:SYSTem:PRESet[:USER]:SAVE
Uses this command to save the current instrument state as the user state for the power on setting and preset type.
Key access: Shift > System > Pwr On/Off Preset > Save User
Programmer’s Guide 63
5 Command Reference
Key access: Shift > System > Pwr On/Off Preset > DC Pwr In
Key access: Freq > More > Low Frequency
DC Power In Type
:SYSTem:CONFigure:DCPI STANDBY|PWRON :SYSTem:CONFigure:DCPI?
This command toggles the DC power in type between standby and power on. When it is set to standby, the analyzer will be in standby mode after the power is plugged in. When it is set to power on, the analyzer will be in power on mode once the power is plugged in.
Low Frequency Channel Status
:SYSTem:CONFigure:LFCHannel OFF|ON|0|1 :SYSTem:CONFigure:LFCHannel?
Use this command to turn on/off the low frequency channel status.
Power Reset
:SYSTem:POWer:RESet
Use this command to restart the instrument.
Power Off
:SYSTem:POWer:OFF
Use this command to turn off the instrument.
Speaker Volume
:SYSTem:SPEaker <value>
:SYSTem:SPEaker?
Use this command to adjust the volume of the speaker.
Example: :SYSTem:SPEaker 20
64 Programmer’s Guide
Speaker Volume Flag
:SYSTem:SPEaker:STATe OFF|ON|0|1
:SYSTem:SPEaker:STATe?
Use this command to turn on the speaker in the instrument.
Example: :SYSTem:SPEaker:STATe?
Hardware Message
:SYSTem:CONFigure:HARDware?
Use this command to query the hardware message of the instrument.
Software Message
:SYSTem:CONFigure:SOFTware?
Use this command to query the software message of the instrument.
System Message
Command Reference 5
:SYSTem:CONFigure:SYSTem?
Use this command to query the system message of the instrument.
Example: :SYSTem:CONFigure:SYSTem?
System Time Sync to GPS
:SYSTem:TIME:SYNCtogps
Use this command to turn on/off the synchronization HSA system time to GPS. This command is only available with the option GPS installed, and when GPS is turned on.
Key access: Shift > System > Time/Date> Sync to GPS
Programmer’s Guide 65
5 Command Reference
NOTE

Memory Subsystem

The Memory subsystem provides access to mass storage devices such as internal or external disk drives. It is corresponding to the front panel file submenu.
The catalog C:\ indicates the root directory of the internal memory of analyzer. The catalog E:\ indicates the root directory of the USB memory stick.
Catalog the Selected Memory Location
:MMEMory:CATalog? <“dir_path”>
Lists all files in the specified path. The return data will be of the format:
<mem_used(kByte)>, <mem_free(kByte)>, <total Items>, <item_listing>.
Each < item listing> indicates the name, type, and size of each item list: <name>, <type>, <size(Byte)>, <modified time>.
“C:\” is HSA internal memory address, and “E:\” is the external USB storage device address.
Example: :MMEMory:CATalog? "C:\"
Key access: Shift >File
Copy a File
:MMEMory:COPY <file_name1>,<file_name2>
This command is used to copy a file. The source file name is <file_name1> and the destination file name is <file_name2>. “C:\” is HSA internal memory address, and “E:\” is the external USB storage device address.
Example: :MMEMory:COPY "C:\N934X.jpg", "E:\N9342C.jpg"
Key access: Shift > File > Files Operation > Copy To
66 Programmer’s Guide
Command Reference 5
Move Data to File
:MMEMory:DATA <file_name>,<definite_length_block>
:MMEMory:DATA? <file_name>
Loads <definite_length_block> into the memory location <file_name>. The query returns the contents of the <file_name> in the format of a definite length block. This command can be used for copying files out of the analyzer over the remote bus.
Example: If want to load string “abcd” into file C:\
source.txt, use below command.
:MMEM:DATA "C:\source.txt",#14abcd
Delete a File
:MMEMory:DELete <"file_name”>
To delete a file. If <file_name> does not exist, a File Name Error will occur.
Example: :MMEMory:DELete “C:\ABC.TRC”
Key access: Shift > File > Files Operation > Delete
Load a File
:MMEMory:LOAD TRC|STA|SET|LIM|ANT|STD|COR,<“file_name”>
To load a file. If <file_name> does not exist, a File Name Error will occur.
Example: :MMEMory:LOAD TRC,"C:\N934X_1.TRC"
Key access: Shift > File > Recall
Store a File
:MMEMory:STORe TRC|STA|SET|LIM|ANT|STD|COR,<“file_name”>
To load a file. DAT|STA|SET||JPG|BMP|CSV indicates the file type.
Example: :MMEMory:STORe STA,“C:\ABC.STA”
Key access: Shift > File > Save As
Programmer’s Guide 67
5 Command Reference
Key access: Shift > Peak > More > Peak Table > Export Table to CSV
Key access: Shift > File > Directory > Create Folder
Store Peak Table to CSV File
:MMEMory:STORe:PEAK <CSV file_name>
To store the current peak table as a CSV file. The suffix of the file name must be *.csv.
Example: :MMEMory:STORe:PEAK “C:\ABC.CSV”
Create A New Directory
:MMEMory:MDIRectory <“dir_path”>
Use this command to create a new directory to the HSA internal memory or external USB memory.
Example: :MMEMory:MDIRectory “C:\User”
Delete A Directory
:MMEMory:RDIRectory <“dir_path”>
Use this command to delete a directory from the internal memory.
Example: :MMEMory:RDIRectory “C:\USER”
Key access: Shift > File > Directory > Delete Folder
Rename A Directory or File
:MMEMory:REName <oldname>,<newname>
To rename a directory or a file.
Example: :MMEMory:REName “C:\USER”,”C:\USER1”
Key access: Shift > File > Directory > Rename Folder
68 Programmer’s Guide
Command Reference 5
Load Correction File
:MMEMory:LOAD:CORRection ANTenna|CABLe|OTHer|USER, "oldname.cor"
This command loads correction file saved on the instrument.
Example: :MMEMory:LOAD:CORRection ANTenn,"oldname.cor"
Key access: Amptd > More > Correction > Correction 1 > Load User, then choose a
file with knob and “Enter” button
Programmer’s Guide 69
5 Command Reference

Instrument Subsystem

The instrument subsystem includes commands selecting the instrument modes or power measurement mode.
Instrument Mode Switch
:INSTrument[:SELect] SA|TGENerator|MA|POWme­ter|CAT :INSTrument[:SELect]?
This command selects the instrument mode of HSA. All the instrument modes are under Mode list of HSA unit.
SA - Spectrum Analyzer mode.
TGENerator - Tracking Generator mode.
MA - Modulation Analysis mode.
POWmeter - Power Meter mode.
CAT - Cable and Antenna Test mode
*RST: SA
Example: :INSTrument TGENerator
Key access: MODE
Measurement Mode Switch
:INSTrument:MEASure OFF|CHPower|ACPR|OBW|SPEC­trogram|SEM|CHScanner :INSTrument:MEASure?
This command selects the specific power measurement mode.
CHPower - Channel Power Measurement
ACPR - Adjacent Channel Power Ratio Measurement
OBW - Occupied Bandwidth Measurement
SPECtrogram - Spectrum Monitor
70 Programmer’s Guide
SEM - Spectrum Emission Mask
CHScanner - Channel Scanner
Example: :INSTrument:MEASure CHPower
Key access: MEAS
Command Reference 5
Programmer’s Guide 71
5 Command Reference

Sense Subsystem

Frequency Subsection
Example: :FREQuency:CENTer 2 GHZ
Key access: Freq > Center Freq
The Sense Subsystem provides you the SCPI command reference for normal spectrum analyzer function. It is used to set the spectrum analyzer parameters such as frequency, span, attenuation and detector.
Center Frequency
[:SENSe]:FREQuency:CENTer <freq> [:SENSe]:FREQuency:CENTer UP|DOWN [:SENSe]:FREQuency:CENTer?
Set the center frequency of the spectrum analyzer.
*RST: 3.5 GHz
Center Frequency Channel
[:SENSe]:FREQuency:CENTer:CHANnel <channel> [:SENSe]:FREQuency:CENTer:CHANnel?
Set the center frequency channel of the spectrum analyzer.
Example: :FREQuency:CENTer:CHANnel 100
Key access: Freq > Unit >Channel, then Center Freq
Start Frequency
[:SENSe]:FREQuency:STARt <freq> [:SENSe]:FREQuency:STARt?
Set the start frequency of the spectrum analyzer.
*RST: 0 Hz
Example: :FREQuency:STARt 3 GHZ
Key access: Freq > Start Freq
72 Programmer’s Guide
Stop Frequency
[:SENSe]:FREQuency:STOP <freq> [:SENSe]:FREQuency:STOP?
Set the stop frequency of the spectrum analyzer.
*RST: 7.0 GHz
Default Unit: Hz
Example: :FREQuency:STOP 3 GHZ
Key access: Freq > Stop Freq
Center Frequency Step
[:SENSe]:FREQuency:CENTer:STEP[:INCRement] <freq> [:SENSe]:FREQuency:CENTer:STEP[:INCRement]?
Specifies the center frequency step size.
*RST: 300 MHz
Example: :FREQuency:CENTer:STEP 2 GHz
Key access: Freq > CF Step Man
Command Reference 5
Center Frequency Channel Step
[:SENSe]:FREQuency:CENTer:STEP[:INCRement]:CHANnel <channel>
[:SENSe]:FREQuency:CENTer:STEP[:INCRement]:CHANnel?
Specifies the center frequency Channel Step.
Example: :FREQuency:CENTer:STEP:CHANnel 3
Key access: Freq > More > CF Step Man
Frequency Unit
[:SENSe]:FREQuency:UNIT FREQuency|CHANnel [:SENSe]:FREQuency:UNIT?
Toggle the frequency unit between frequency and chanel.
Example: :FREQuency:UNIT CHANnel
Key access: Freq > Unit
Programmer’s Guide 73
5 Command Reference
Key access: Freq > More > Freq Offset
Key access: Freq > CF Step Auto/Man
Frequency Offset
[:SENSe]:FREQuency:OFFSet <freq> [:SENSe]:FREQuency:OFFSet?
Sets the frequency offset.
*RST: 0.0 Hz
Example: :FREQuency:OFFSet 1 GHZ
Center Frequency Step Size Automatic
[:SENSe]:FREQuency:CENTer:STEP:AUTO OFF|ON|0|1 [:SENSe]:FREQuency:CENTer:STEP:AUTO?
Specifies whether the step size is set automatically based on the span.
*RST: On
Frequency Span
[:SENSe]:FREQuency:SPAN <freq> [:SENSe]:FREQuency:SPAN?
Set the frequency span. Setting the span to 0 Hz puts the analyzer into zero span.
*RST: 7.0 GHz
Example: :FREQuency:SPAN 2 GHZ
Key access: Span
Span Channel
[:SENSe]:FREQuency:SPAN:CHANnel <Channel> [:SENSe]:FREQuency:SPAN:CHANnel?
Set the span channel when the frequency unit is set to channel.
Example: :FREQuency:SPAN:CHANnel 20
Key access: Span
74 Programmer’s Guide
Full Frequency Span
[:SENSe]:FREQuency:SPAN:FULL
Set the frequency span to full scale.
*RST: 3.0 GHz
Example: :FREQuency:SPAN:FULL
Key access: Span > Full Span
Zero Span
[:SENSe]:FREQuency:SPAN:ZERO
Set the frequency span to zero span.
Key access: Span > Zero Span
Last Frequency Span
[:SENSe]:FREQuency:SPAN:PREVious
Set the frequency span to the previous span setting.
Key access: Span > Last Span
Command Reference 5
Auto Tune
[:SENSe]:FREQuency:TUNE:IMMediate
Auto tune the spectrum analyzer parameter to display the main signal.
Example: :FREQuency:TUNE:IMMediate
Key access: Freq > Auto Tune
Base Band Channel Switch
[:SENSe]:FREQuency:LFCHannel OFF|ON|0|1 [:SENSe]:FREQuency:LFCHannel?
Use this command to turn on/off low frequency channel.
Example: :FREQuency:LFCHannel ON
Key access: Freq > More > LowFreqChannel > ON/Off
Programmer’s Guide 75
5 Command Reference
Amplitude Subsection
Key access: Amptd > Ref Level
Key access: Amptd > Attenuation
Reference level
:DISPlay:WINDow:TRACe:Y[:SCALe]:RLEVel: <value> :DISPlay:WINDow:TRACe:Y[:SCALe]:RLEVel?
This command sets the reference level for the Y-axis.
*RST: 0 dB
Range: –140.00 to +20.00 dBm
Example: :DISPlay:WINDow:TRACe:Y:RLEVel 10dBm
Attenuation
[:SENSe]:POWer[:RF]:ATTenuation <value> [:SENSe]:POWer[:RF]:ATTenuation?
Set the input attenuator of the spectrum analyzer.
Range: 0 to 50 dB
Example: :POWer:ATTenuation 30dB
Input Port Attenuator Auto State
[:SENSe]:POWer[:RF]:ATTenuation:AUTO OFF|ON|0|1 [:SENSe]:POWer[:RF]:ATTenuation:AUTO?
This command turns on/off auto input port attenuator state.
*RST: On
Example: :POWer:ATTenuation:AUTO?
Key access: Amptd > Attenuation > Auto
76 Programmer’s Guide
Command Reference 5
Input Port Preamplifer
[:SENSe]:POWer[:RF]:GAIN[:STATe] OFF|ON|0|1 [:SENSe]:POWer[:RF]:GAIN[:STATe]?
Turns the internal preamp on/off.
*RST: Off
Remarks: This command is only available when PA7 option is installed.
Example: :POWer:GAIN ON
Key access: AMPTD >
Preamp On/Off
Scale/DIV
:DISPlay:WINDow:TRACe:Y[:SCALe]:PDIVision DIV1|DIV2|DIV5|DIV10 :DISPlay:WINDow:TRACe:Y[:SCALe]:PDIVision?
This command sets the per-division display scaling for the y-axis when scale type of Y axis is set to Log.
*RST: 10 dB
Range: 1, 2, 5 or 10
Example: :DISPlay:WINDow:TRACe:Y:PDIVision DIV5
Key access: Amptd > Scale/DIV
Scale Type
:DISPlay:WINDow:TRACe:Y[:SCALe]:SPACing LIN­ear|LOGarithmic :DISPlay:WINDow:TRACe:Y[:SCALe]:SPACing?
Toggles the vertical graticule divisions between logarithmic unit and linear unit. The default logarithmic unit is dBm, and the linear unit is mV.
*RST: Log
Example: :DISPlay:WINDow:TRACe:Y:SPACing LINear
Key access: Amptd > Scale Type > Log/Lin
Programmer’s Guide 77
5 Command Reference
Key access: Amptd > Y Axis Unit
Key access: AMPTD >
Power Units of Measure ( Y Axis Unit )
:UNIT:POWer DBM|DBMV|DBMVEMF|DBUV|DBU­VEMF|V|W|VEMF :UNIT:POWer?
Specifies amplitude units for the input, output and display.
*RST: dBm in log amplitude scale
Volts in linear amplitude scale
Example: :UNIT:POWer DBMV
Hi-Sensitive
[:SENSe]:POWer[:RF]:HSENsitive[:STATe] OFF|ON|0|1 [:SENSe]:POWer[:RF]:HSENsitive [:STATe]?
Toggles the Hi-sensitive function between on and off.
More > Hi-sensitivity
Reference Offset Level
:DISPlay:WINDow:TRACe:Y[:SCALe]:RLEVel:OFFSet <value> :DISPlay:WINDow:TRACe:Y[:SCALe]:RLEVel:OFFSet?
This command sets the amplitude offset level for the Y-Axis.
*RST: 0 dB
Range: –327.60 to +327.60 dB
Example: :DISPlay:WINDow:TRACe:Y:RLEVel:OFFSet 20dB
Key access: Amptd > More > Ref Offset
Correction Off
[:SENSe]:CORRection:OFF
Turn off the amplitude correction function off.
Key access: Amptd > More > Amp Correction > Off
78 Programmer’s Guide
Command Reference 5
Correction Apply State
[:SENSe]:CORRection:CSET:ALL[:STATe] OFF|ON|0|1
[:SENSe]:CORRection:CSET:ALL[:STATe]?
Turns On or Off the amplitude corrections. When turned On, only the correction sets that were turned on are enabled. When turned Off, all of the correction sets are disabled. If there is no correction enabled, state can not be set to on
Example: :CORRection:CSET:ALL ON
Key access: Amptd > Corrections > Apply Corrections > On
Set Correction X state Off
[:SENSe]:CORRection:CSET[1]|2|3|4:OFF [:SENSe]:CORRection:CSET[1]|2|3|4[:STATe]?
Turns the amplitude correction function on/off.
Example: :CORRection:CSET2:OFF
Key access: Amptd > Corrections > Correction1 > On
Correction Antenna Unit State
[:SENSe]:CORRection:CSET:ANTUnit OFF|ON|0|1 [:SENSe]:CORRection:CSET:ANTUnit?
Turns the antenna unit on/off.
Example: :CORRection:CSET:ANTUnit ON
Key access: Amptd > Corrections > Antenna Unit > On
Read Correction X Data
[:SENSe]:CORRection:CSET[1]|2|3|4:DATA?
Query amplitude correction data.
Example: :CORRection:CSET2:DATA?
Programmer’s Guide 79
5 Command Reference
Key access: Amptd > More > Impedance
Current Correction Select
[:SENSe]:CORRection:SELect COR1|COR2|COR3|COR4 [:SENSe]:CORRection:SELect?
Set current correction for load COR file onto proper CorrectionX.
Example: :CORRection:SELect?
Input Impedance selection
[:SENSe]:CORRection:IMPedance[:INPut][:MAGNitude] OHM50|OHM75
[:SENSe]:CORRection:IMPedance[:INPut][:MAGNitude]?
Toggles the input impedance correction between 50 Ω and 75 Ω. in spectrum analyzer.
*RST: OHM50
Example: :CORRection:IMPedance OHM75
PSD Mode State
:DISPlay:WINDow:TRACe:Y:PSD OFF|ON|0|1 :DISPlay:WINDow:TRACe:Y:PSD?
Use this command to turn on/off the power spectral density display mode.
Example: :DISPlay:WINDow:TRACe:Y:PSD 1
Key access: Amptd > More > PSD Function > On/Off
80 Programmer’s Guide
Bandwidth Subsection
Resolution Bandwidth
[:SENSe]:BANDwidth|BWIDth[:RESolution] <freq> [:SENSe]:BANDwidth|BWIDth[:RESolution]?
Specifies the resolution bandwidth. For numeric entries, all RBW types choose the nearest (arithmetically, on a linear scale, rounding up) available RBW to the value entered.
Range: 10 Hz to 3 MHz
Default Unit: Hz
Example: :BAND 1 kHz
Key access: BW > RBW
Auto Resolution Bandwidth State
[:SENSe]:BANDwidth|BWIDth[:RESolution]:AUTO OFF|ON|0|1 [:SENSe]:BANDwidth|BWIDth[:RESolution]:AUTO?
This command turns on/off auto resolution bandwidth state.
*RST: On
Example: :BWID:AUTO On
Command Reference 5
Video Bandwidth
[:SENSe]:BANDwidth|BWIDth:VIDeo <freq> [:SENSe]:BANDwidth|BWIDth:VIDeo?
Specifies the video bandwidth.
*RST: 3 MHz
Range: 1 Hz to 3 MHz. This range is dependent upon the setting of
[:SENSe]:BANDwidth|BWIDth[:RESolution].
Default Unit: Hz
Example: :BANDwidth:VIDeo 10 KHZ
Key access: BW > VBW Auto Man
Programmer’s Guide 81
5 Command Reference
Key access: BW > VBW Auto/Man
Key access: BW > VBW/RBW Ratio
Auto Video Bandwidth State
[:SENSe]:BANDwidth|BWIDth:VIDeo:AUTO OFF|ON|0|1 [:SENSe]:BANDwidth|BWIDth:VIDeo:AUTO?
This command turns on/off auto video bandwidth state.
*RST: On
Video to Resolution Bandwidth Ratio
[:SENSe]:BANDwidth|BWIDth:VIDeo:RATio <number> [:SENSe]:BANDwidth|BWIDth:VIDeo:RATio?
Specifies the ratio of the video bandwidth to the resolution bandwidth.
*RST: 1.0
Range: 0.00001 to 3.0e6
Example: :BANDwidth:VIDeo:RATio 30
Auto Video to Resolution Bandwidth Ratio State
[:SENSe]:BANDwidth|BWIDth:VIDeo:RATio:AUTO OFF|ON|0|1 [:SENSe]:BANDwidth|BWIDth:VIDeo:RATio:AUTO?
This command turns on/off auto video to resolution bandwidth ratio.
*RST: Auto
Example: :BANDwidth:VIDeo:RATio:AUTO ON
Key access: BW > VBW/RBW Auto Man
82 Programmer’s Guide
Trace Subsection
Select Trace Display Mode
:TRACe1|2|3|4:MODE WRITe|MAXHold|MIN­Hold|VIEW|BLANk :TRACe1|2|3|4:MODE?
Selects the display mode for the selected trace.
WRITe puts the trace in the normal mode, updating the data.
MAXHold displays the highest measured trace value for all the data that
has been measured since the function was turned on.
MINHold displays the lowest measured trace value for all the data that has been measured since the function was turned on.
VIEW turns on the trace data so that it can be viewed on the display.
BLANK turns off the trace data so that it is not viewed on the display.
Example: :TRAC1:MODE VIEW
Key access: Trace > Clear Write|Max Hold|Min Hold|View|Blank
Command Reference 5
Trace Max/Min Hold By Count
:TRACe[1]|2|3|4:HOLD:COUNt <value> :TRACe[1]|2|3|4:HOLD:COUNt?
Use this command to set the Max/Min hold counter.
Example: :TRACe:HOLD:COUNt 20
Key access: Trace > More > Max/Min Number On
Add Trace
:TRACe:MATH:ADD <destination_trace>,<source_trace1>,<source_trace2>
This command adds the selected trace on the activated trace.
Example: :TRAC:MATH:ADD TRACE2,TRACE1,TRACE3
Programmer’s Guide 83
5 Command Reference
Subtract Trace
:TRACe:MATH:SUBTract <destination_trace>,<source_trace1>,<source_trace2>
This command subtract the selected trace from the activated trace.
Example: :TRAC:MATH:SUBT TRACE2,TRACE1,TRACE3
Query Trace Data
:TRACe[:DATA]? TRACe1|TRACe2|TRACe3|TRACe4|
This query command returns the current displayed data.
Example: :TRACe:DATA? TRACE1
Tra ce M at h By
:TRACe:MATH:TYPE LOGPwr|POWer :TRACe:MATH:TYPE?
This command toggles the trace math by log power and power.
Example: :TRACe:MATH:TYPE LOGP
Key access: Trace > More > Trace Math By
Tra ce M at h Of f
:TRACe:MATH:OFF
This command turns off the trace math function.
Key access: Trace > More > Math Type > Off
Trace Format
:FORMat[:TRACe][:DATA]ASCii|REAL
This command toggles the return trace data format between ASCii and real format. ASC is standard ASCII string be separated by comma. REAL is 4 bytes length float without comma.
84 Programmer’s Guide
Detector Subsection
Typ e o f D e te ct io n
[:SENSe]:DETector:TRACe[1]|2|3|4[:FUNCtion]NEGa­tive|POSitive|SAMPle|AVERage|NORMAL [:SENSe]:DETector:TRACe[1]|2|3|4[:FUNCtion]?
Specifies the detection mode. For each trace interval (bucket), average detection displays the average of all the samples within the interval.
Negative peak detection displays the lowest sample taken during the
interval being displayed.
Positive peak detection displays the highest sample taken during the
interval being displayed.
Sample detection displays the sample taken during the interval being
displayed, and is used primarily to display noise or noise-like signals. In sample mode, the instantaneous signal value at the present display point is placed into memory. This detection should not be used to make the most accurate amplitude measurement of non noise-like signals.
Average detection is used when measuring the average value of the
amplitude across each trace interval (bucket). The averaging method used by the average detector is set to either video or power as appropriate when the average type is auto coupled.
Normal detection selects the maximum and minimum video signal
values alternately. When selecting Normal detection, “Norm” appears in the upper-left corner.
*PST: Positive
Example: :DETector:TRACe1 SAMPle
Key access: Trace > More > Detector
Command Reference 5
Programmer’s Guide 85
5 Command Reference
Average Subsection
Key access: BW > Average Type
Key access: Trace > More > Average
Average Type
[:SENSe]:AVERage:TYPE LOGPower|POWer|VOLTage [:SENSe]:AVERage:TYPE?
Toggle the average type between Log power, power and voltage.
Example: :AVERage:TYPE POW
Average Number On/Off
[:SENSe]:AVERage:TRACe[1]|2|3|4:COUNt <integer> [:SENSe]:AVERage:TRACe[1]|2|3|4:COUNt?
Specifies the number of measurements that are combined.
Range: 1 to 8192
[:SENSe]:AVERage:TRACe[1]|2|3|4[:STATe] OFF|ON|0|1 [:SENSe]:AVERage:TRACe[1]|2|3|4[:STATe]?
This command toggles averaging off and on.
Example: :AVERage:TRACe1:COUNt 20
Average Duration On/Off
[:SENSe]:AVERage:TRACe[1]|2|3|4:DURation <value> [:SENSe]:AVERage:TRACe[1]|2|3|4:DURation?
Sets the duration of average process.
[:SENSe]:AVERage:TRACe[1]|2|3|4:DURation:STATe OFF|ON|0|1
[:SENSe]:AVERage:TRACe[1]|2|3|4:DURation:STATe?
This command toggles the averaging duration off and on.
Example: :AVERage:TRACe1:DURation 2S
Key access: Trace > More > Average Duration On/Off
86 Programmer’s Guide
Average Restart
[:SENSe]:AVERage:TRACe[1]|2|3|4:CLEar
Restarts the trace average. This command is only available when average is on.
Example: :AVERage:TRACe1:CLEar
Key access: Trace > More > Average Restart
Sweep Subsection
Sweep Time
[:SENSe]:SWEep:TIME <time> [:SENSe]:SWEep:TIME?
Specifies the time in which the instrument sweeps the display. A span value of 0 Hz causes the analyzer to enter zero span mode. In zero span the X-axis represents time rather than frequency.
Command Reference 5
[:SENSe]:SWEep:TIME:AUTO OFF|ON|0|1 [:SENSe]:SWEep:TIME:AUTO?
This command turns on/off auto sweep time state.
Example: :SWEep:TIME 5s
Key access: Shift > Sweep > Sweep Time > Auto Man
Sweep Speed
[:SENSe]:SWEep:SPEed NORMal|FAST [:SENSe]:SWEep:SPEed?
Toggles the sweep speed between normal and fast.
*RST: Fast
Example: :SWEep:SPEed NORMal
Key access: Shift > Sweep > Sweep Setup > Sweep Speed Accuracy/Speed
Programmer’s Guide 87
5 Command Reference
Key access: Shift > Sweep > Sweep Setup > Sweep Type
Key access: Shift > Sweep > Gated Sweep > Gated Sweep > On/Off
Sweep Mode
[:SENSe]:SWEep:MODE AUTO|FFT|SWEep [:SENSe]:SWEep:MODE?
Sets the sweep mode manually.
*RST: AUTO
Gated Sweep State
[:SENSe]:SWEep:EGATe[:STATe] OFF|ON|0|1 [:SENSe]:SWEep:EGATe[:STATe]?
Use this command to turn on/off gated sweep mode.
Example: :SWEep:EGATe ON
Gate View
[:SENSe]:SWEep:EGATe:VIEW ON|OFF|1|0 [:SENSe]:SWEep:EGATe:VIEW?
Use this command to turn on/off gate view. The gated view can be enable when the gated sweep is turned on.
Example: :SWEep:EGATe:VIEW ON
Key access: Shift > Sweep > Sweep Setup > Gated Sweep > Gate View > On
Gate View Sweep Time
[:SENSe]:SWEep:EGATe:TIME <time> [:SENSe]:SWEep:EGATe:TIME?
Set the gated view sweep time. The time unit of this command is second.
Example: :SWEep:EGATe:TIME 0.002
Key access: Shift > Sweep > Sweep Setup > Gated Sweep > View Sweep Time
88 Programmer’s Guide
Command Reference 5
Gate Delay
[:SENSe]:SWEep:EGATe:DELay <time> [:SENSe]:SWEep:EGATe:DELay?
Set the gate delay time.
Example: :SWEep:EGATe:DELay 0.003
Key access: Shift > Sweep > Sweep Setup > Gated Sweep > Gate Delay
Gate Length
[:SENSe]:SWEep:EGATe:LENGth <time> [:SENSe]:SWEep:EGATe:LENGth?
Set the gate length of the gated sweep.
Example: :SWEep:EGATe:LENGth 0.5
Key access: Shift > Sweep > Sweep Setup > Gated Sweep > Gate Length
Gate Source
[:SENSe]:SWEep:EGATe:SOURce EXTer­nal|FRAMe|RFBurst [:SENSe]:SWEep:EGATe:SOURce?
Set the gate trigger source of gate sweep.
Example: :SWEep:EGATe:SOURce?
Key access: Shift > Sweep > Sweep Setup > Gated Sweep > Gate Delay
Programmer’s Guide 89
5 Command Reference
Display Subsection
Key access: Shift > Disp > Graticule On/Off
Key access: Shift > Disp > Y Scale On/Off
Graticule State
:DISPlay:WINDow:TRACe:GRATicule:GRID[:STATe] OFF|ON|0|1 :DISPlay:WINDow:TRACe:GRATicule:GRID[:STATe]?
This command toggles the graticule between on and off.
Example: :DISPlay:WINDow:TRACe:GRATicule:GRID OFF
Y Scale State
:DISPlay:WINDow:TRACe:YSCale[:STATe] OFF|ON|0|1 :DISPlay:WINDow:TRACe:YSCale[:STATe]?
This command toggles the Y Scale between on and off.
Example: :DISPlay:WINDow:TRACe:YSCale ON
Display Line
:DISPlay:WINDow:TRACe:Y:DLINe <value> :DISPlay:WINDow:TRACe:Y:DLINe?
Sets the amplitude value for the display line.
:DISPlay:WINDow:TRACe:Y:DLINe:STATe OFF|ON|0|1 :DISPlay:WINDow:TRACe:Y:DLINe:STATe?
Toggles the display line between on and off.
Example: :DISPlay:WINDow:TRACe:Y:DLINe -10
Key access: Shift > Disp > Display LIne
90 Programmer’s Guide

Calculate Subsystem

Limit Line Subsection
Example: :CALCulate:LLINe:TYPE UPPer
Key access: Shift > Limit > Limit 1 > Limit Type
Command Reference 5
This subsystem is used to perform post-acquisition data processing. In effect, the collection of new data triggers the CALCulate subsystem. In this instrument, the primary functions in this subsystem are markers and limits.
Limit lines can be defined for your measurement. You can then have the instrument compare the data to your defined limits and indicate a pass/fail condition.
Type of Limit Line
:CALCulate:LLINe[1]:TYPE UPPer|LOWer :CALCulate:LLINe[1]:TYPE?
Sets a limit line to be either an upper or lower type limit line. An upper line will be used as the maximum allowable value when comparing with the data.
Limit Line State
:CALCulate:LLINe[1]|2:STATe OFF|ON|0|1 :CALCulate:LLINe[1]|2:STATe?
Toggles the limit line function between on and off.
Key access: Shift > Limit > Limit 1> Limit Line On/Off
Fixed/Relative Limit
:CALCulate:LLINe:CMODe FIXed|RELative :CALCulate:LLINe:CMODe?
Toggles the limit line mode between fixed and relative.
Key access: Shift > Limit > Limits Fixed/Rel
Programmer’s Guide 91
5 Command Reference
Key access: Shift > Limit> Limit 1 > Limit Line
Key access: Shift > Limit > X Axis Units
Limit Line Y-axis Value
:CALCulate:LLINe[1]:Y <value> :CALCulate:LLINe[1]:Y?
Sets the Y-axis value of a limit line. Limit line Y-axis value is set independently and is not affected by the X-axis units.
*RST: 0 dBm
Example: :CALCulate:LLINe:Y -20dBm
Limit Line X-axis Value
:CALCulate:LLINe:CONTrol:DOMain FREQuency|TIME :CALCulate:LLINe:CONTrol:DOMain?
Toggles the limit line X-axis value between frequency and time.
Example: :CALCulate:LLINe:CONTrol:DOMain FREQuency
Limit State
:CALCulate:LLINe[1]|2:DISPlay OFF|ON|0|1 :CALCulate:LLINe[1]|2:DISPlay?
Toggles the limits state between on and off.
Key access: Shift > Limit > Limit 1> Limit On/Off
Query Current Limits Result
:CALCulate:LLINe[1]|2:FAIL?
This query returns the limits pass/failed result. If the test result fail, this command will get result 1. If the test result pass the limit, it will get result 0.
Example: :CALCulate:LLINe:FAIL?
92 Programmer’s Guide
Loading...