Keysight (Agilent) DSO80804B Programming Guide

Infiniium
80000B Programmer’s Reference
Agilent Technologies
Publication Number D8104-97013 August 2008
This reference applies directly to software revision code A.05.50 and later.
© Copyright Agilent Technologies 2008 All Rights Reserved.
80000B Series Infiniium Oscilloscopes
In This Book
This book is your guide to programming the Infiniium 80000B Series Oscilloscopes.
Chapters 1 through 5 give you an introduction to programming the oscilloscopes, along with necessary conceptual information. These chapters describe basic program communications, interface, syntax, data types, and status reporting.
Chapter 6 shows example BASIC and C programs, and describes chunks of one program to show you some typical applications. The BASIC and C example programs are also shipped on a disk with the oscilloscope.
Chapters 7 through 25 describe the commands used to program the oscilloscopes. Each chapter describes the set of commands that belong to an individual subsystem, and explains the function of each command. These chapters include:
ACQuire Mask TESt
CALibration MEASure
CHANnel Root Level
Common SELFtest
DISK SYSTem
DISPlay TIMe Base
FUNCtion TRIGger
HARDcopy WAVeform
HISTogram Waveform MEMory
MARKer
Chapter 30 describes error messages.
ii
Contents
1 Introduction to Programming
Communicating with the Oscilloscope 1-3 Output Command 1-4 Device Address 1-4 Instructions 1-4 Instruction Header 1-4 White Space (Separator) 1-5 Braces 1-5 Ellipsis 1-5 Square Brackets 1-5 Command and Query Sources 1-5 Program Data 1-6 Header Types 1-7 Duplicate Mnemonics 1-9 Query Headers 1-10 Program Header Options 1-11 Character Program Data 1-11 Numeric Program Data 1-12 Embedded Strings 1-13 Program Message Terminator 1-13 Common Commands within a Subsystem 1-14 Selecting Multiple Subsystems 1-14 Programming Getting Started 1-14 Initialization 1-15 Example Program using HP Basic 1-16 Using the DIGITIZE Command 1-17 Receiving Information from the Oscilloscope 1-19 String Variable Example 1-20 Numeric Variable Example 1-20 Definite-Length Block Response Data 1-21 Multiple Queries 1-22 Oscilloscope Status 1-22
2 LAN and GPIB Interfaces
LAN Interface Connector 2-3 GPIB Interface Connector 2-3 Default Startup Conditions 2-4 Interface Capabilities 2-5 GPIB Command and Data Concepts 2-6 Communicating Over the GPIB Interface 2-7 Communicating Over the LAN Interface 2-8 Communicating via Telnet and Sockets 2-10 Bus Commands 2-12
3 Message Communication and System Functions
Contents-1
Contents
Protocols 3-3
4 Status Reporting
Status Reporting Data Structures 4-5 Status Byte Register 4-8 Service Request Enable Register 4-10 Message Event Register 4-10 Trigger Event Register 4-10 Standard Event Status Register 4-11 Standard Event Status Enable Register 4-12 Operation Status Register 4-13 Operation Status Enable Register 4-14 Mask Test Event Register 4-15 Mask Test Event Enable Register 4-16 Trigger Armed Event Register 4-17 Acquisition Done Event Register 4-17 Error Queue 4-18 Output Queue 4-18 Message Queue 4-19 Clearing Registers and Queues 4-19
5 Remote Acquisition Synchronization
Introduction 5-2 Programming Flow 5-2 Setting Up the Oscilloscope 5-2 Acquiring a Waveform 5-3 Retrieving Results 5-3 Acquisition Synchronization 5-4 Single Shot Device Under Test (DUT) 5-5 Averaging Acquisition Synchronization 5-7
6 Programming Conventions
Truncation Rule 6-3 The Command Tree 6-4 Infinity Representation 6-12 Sequential and Overlapped Commands 6-12 Response Generation 6-12 EOI 6-12
7 Sample Programs
Sample Program Structure 7-3 Sample C Programs 7-4 Listings of the Sample Programs 7-18 gpibdecl.h Sample Header 7-19 srqagi.c Sample Program 7-21 learnstr.c Sample Program 7-23
Contents-2
sicl_IO.c Sample Program 7-27 natl_IO.c Sample Program 7-32 init.bas Sample Program 7-37 srq.bas Sample Program 7-45 lrn_str.bas Sample Program 7-51
8 Acquire Commands
AVERage 8-3 AVERage:COUNt 8-4 COMPlete 8-5 COMPlete:STATe 8-7 BANDwidth 8-8 INTerpolate 8-10 MODE 8-11 POINts 8-13 POINts:AUTO 8-16 SEGMented:COUNt 8-17 SEGMented:INDex 8-18 SEGMented:TTAGs 8-19 SRATe (Sample RATe) 8-20 SRATe Sample Rate Tables for the 80000B Series Oscilloscopes 8-22 SRATe:AUTO 8-24
Contents
9 Bus Commands
B1:TYPE 9-3 BIT<M> 9-4 BITS 9-5 CLEar 9-6 CLOCk 9-7 CLOCk:SLOPe 9-8 DISPlay 9-9 LABel 9-10 READout 9-11
10 Calibration Commands
Oscilloscope Calibration 10-3 Probe Calibration 10-4
Calibration Commands 10-5
OUTPut 10-6 SKEW 10-7 STATus? 10-8
11 Channel Commands
DISPlay 11-3 INPut 11-4
Contents-3
Contents
OFFSet 11-5 PROBe 11-6 PROBe:ATTenuation 11-8 PROBe:EADapter 11-9 PROBe:ECoupling 11-11 PROBe:EXTernal 11-13 PROBe:EXTernal:GAIN 11-14 PROBe:EXTernal:OFFSet 11-16 PROBe:EXTernal:UNITs 11-18 PROBe:GAIN 11-20 PROBe:HEAD:ADD 11-21 PROBe:HEAD:DELete ALL 11-22 PROBe:HEAD:SELect 11-23 PROBe:ID? 11-24 PROBe:SKEW 11-25 PROBe:STYPe 11-26 RANGe 11-27 SCALe 11-28 UNITs 11-29
12 Common Commands
*CLS (Clear Status) 12-4 *ESE (Event Status Enable) 12-5 *ESR? (Event Status Register) 12-7 *IDN? (Identification Number) 12-9 *LRN? (Learn) 12-10 *OPC (Operation Complete) 12-12 *OPT? (Option) 12-13 *PSC (Power-on Status Clear) 12-14 *RCL (Recall) 12-15 *RST (Reset) 12-16 *SAV (Save) 12-17 *SRE (Service Request Enable) 12-18 *STB? (Status Byte) 12-20 *TRG (Trigger) 12-22 *TST? (Test) 12-23 *WAI (Wait) 12-24
13 Disk Commands
CDIRectory 13-3 COPY 13-4 DELete 13-5 DIRectory? 13-6 LOAD 13-7 MDIRectory 13-8 MSTore (Obsolete) 13-9
Contents-4
PWD? 13-10 SAVe:IMAGe 13-11 SAVe:JITTer 13-12 SAVe:LISTing 13-13 SAVe:MEASurements 13-14 SAVe:SETup 13-15 SAVe:WAVeform 13-16 CSV and TSV Header Format 13-18 BIN Header Format 13-21 SEGMented 13-40 STORe (Obsolete) 13-41
14 Display Commands
CGRade 14-3 CGRade:LEVels? 14-5 COLumn 14-7 CONNect 14-8 DATA? 14-9 DCOLor 14-10 GRATicule 14-11 LABel 14-13 LINE 14-14 PERSistence 14-15 ROW 14-16 SCOLor 14-17 STRing 14-20 TEXT 14-21
Contents
15 Function Commands
FUNCtion<N>? 15-4 ABSolute 15-5 ADD 15-6 AVERage 15-7 COMMonmode 15-8 DIFF (Differentiate) 15-9 DISPlay 15-10 DIVide 15-11 FFT:FREQuency 15-12 FFT:REFerence 15-13 FFT:RESolution? 15-14 FFT:WINDow 15-15 FFTMagnitude 15-17 FFTPhase 15-18 HIGHpass 15-19 HORizontal 15-20 HORizontal:POSition 15-21
Contents-5
Contents
HORizontal:RANGe 15-22 INTegrate 15-23 INVert 15-24 LOWPass 15-25 MAGNify 15-26 MAXimum 15-27 MINimum 15-28 MULTiply 15-29 OFFSet 15-30 RANGe 15-31 SMOoth 15-32 SQRT 15-33 SQUare 15-34 SUBTract 15-35 VERSus 15-36 VERTical 15-37 VERTical:OFFSet 15-38 VERTical:RANGe 15-39
16 Hardcopy Commands
AREA 16-3 DPRinter 16-4 FACTors 16-6 IMAGe 16-7 PRINters? 16-8
17 Histogram Commands
AXIS 17-4 MODE 17-5 SCALe:SIZE 17-6 WINDow:DEFault 17-7 WINDow:SOURce 17-8 WINDow:X1Position | LLIMit 17-9 WINDow:X2Position | RLIMit 17-10 WINDow:Y1Position | BLIMit 17-11 WINDow:Y2Position | TLIMit 17-12
18 InfiniiScan (ISCan) Commands
DELay 18-3 MEASurement:FAIL 18-4 MEASurement:LLIMit 18-5 MEASurement 18-6 MEASurement:TEST 18-7 MEASurement:ULIMit 18-8 MODE 18-9 NONMonotonic:EDGE 18-10
Contents-6
NONMonotonic:HYSTeresis 18-11 NONMonotonic:SOURce 18-12 RUNT:HYSTeresis 18-13 RUNT:LLEVel 18-14 RUNT:SOURce 18-15 RUNT:ULEVel 18-16 SERial:PATTern 18-17 SERial:SOURce 18-18 ZONE<N>:MODE 18-19 ZONE<N>:PLACement 18-20 ZONE:SOURce 18-21 ZONE<N>:STATe 18-22
19 Limit Test Commands
FAIL 19-3 LLIMit 19-4 MEASurement 19-5 RESults? 19-6 TEST 19-7 ULIMit 19-8
20 Marker Commands
CURSor? 20-3 MEASurement:READout 20-4 MODE 20-5 TDELta? 20-6 TSTArt 20-7 TSTOp 20-9 VDELta? 20-11 VSTArt 20-12 VSTOp 20-14 X1Position 20-16 X2Position 20-17 X1Y1source 20-18 X2Y2source 20-19 XDELta? 20-20 Y1Position 20-21 Y2Position 20-22 YDELta? 20-23
Contents
21 Mask Test Commands
ALIGn 21-4 AlignFIT 21-5 AMASk:CREate 21-7 AMASk:SOURce 21-8 AMASk:SAVE | STORe 21-9
Contents-7
Contents
AMASk:UNITs 21-10 AMASk:XDELta 21-11 AMASk:YDELta 21-13 AUTO 21-15 AVERage 21-16 AVERage:COUNt 21-17 COUNt:FAILures? 21-18 COUNt:FWAVeforms? 21-19 COUNt:WAVeforms? 21-20 DELete 21-21 ENABle 21-22 FOLDing 21-23 FOLDing:BITS 21-24 HAMPlitude 21-25 IMPedance 21-26 INVert 21-28 LAMPlitude 21-29 LOAD 21-30 NREGions? 21-31 PROBe:IMPedance? 21-32 RUMode 21-33 RUMode:SOFailure 21-35 SCALe:BIND 21-36 SCALe:X1 21-37 SCALe:XDELta 21-38 SCALe:Y1 21-39 SCALe:Y2 21-40 SOURce 21-41 STARt | STOP 21-42 STIMe 21-43 TITLe? 21-44 TRIGger:SOURce 21-45
22 Measure Commands
AREA 22-8 BWIDth 22-9 CDRRate 22-10 CGRade:CROSsing 22-11 CGRade:DCDistortion 22-12 CGRade:EHEight 22-13 CGRade:EWIDth 22-14 CGRade:JITTer 22-15 CGRade:QFACtor 22-16 CLEar 22-17 CLOCk 22-18
Contents-8
CLOCk:METHod 22-19 CLOCk:VERTical 22-21 CLOCk:VERTical:OFFSet 22-22 CLOCk:VERTical:RANGe 22-23 CTCDutycycle 22-24 CTCJitter 22-26 CTCNwidth 22-28 CTCPwidth 22-30 DATarate 22-32 DEFine 22-34 DELTatime 22-39 DUTYcycle 22-41 FALLtime 22-43 FFT:DFRequency 22-45 FFT:DMAGnitude 22-46 FFT:FREQuency 22-47 FFT:MAGNitude 22-48 FFT:PEAK1 22-49 FFT:PEAK2 22-50 FFT:THReshold 22-51 FREQuency 22-52 HISTogram:HITS 22-54 HISTogram:M1S 22-56 HISTogram:M2S 22-58 HISTogram:M3S 22-60 HISTogram:MAX? 22-62 HISTogram:MEAN? 22-63 HISTogram:MEDian? 22-64 HISTogram:MIN? 22-65 HISTogram:PEAK? 22-66 HISTogram:PP? 22-67 HISTogram:STDDev? 22-68 HOLDtime 22-69 JITTer:HISTogram 22-71 JITTer:MEASurement 22-72 JITTer:SPECtrum 22-73 JITTer:SPECtrum:HORizontal 22-74 JITTer:SPECtrum:HORizontal:POSition 22-75 JITTer:SPECtrum:HORizontal:RANGe 22-77 JITTer:SPECtrum:VERTical 22-78 JITTer:SPECtrum:VERTical:OFFSet 22-79 JITTer:SPECtrum:VERTical:RANGe 22-80 JITTer:SPECtrum:WINDow 22-81 JITTer:STATistics 22-82 JITTer:TRENd 22-83
Contents
Contents-9
Contents
JITTer:TRENd:SMOoth 22-84 JITTer:TREND:SMOoth:POINts 22-85 JITTer:TRENd:VERTical 22-86 JITTer:TRENd:VERTical:OFFSet 22-87 JITTer:TRENd:VERTical:RANGe 22-88 NCJitter 22-89 NWIDth 22-91 OVERshoot 22-93 PERiod 22-95 PHASe 22-97 PREShoot 22-99 PWIDth 22-101 QUALifier<M>:CONDition 22-103 QUALifier<M>:SOURce 22-104 QUALifier<M>:STATe 22-105 RESults? 22-106 RISetime 22-109 RJDJ:ALL? 22-111 RJDJ:BANDwidth 22-113 RJDJ:BER 22-114 RJDJ:EDGE 22-116 RJDJ:INTerpolate 22-117 RJDJ:PLENgth 22-118 RJDJ:SOURce 22-120 RJDJ:STATe 22-121 RJDJ:TJRJDJ? 22-122 RJDJ:UNITs 22-123 SCRatch 22-124 SENDvalid 22-125 SETuptime 22-126 SLEWrate 22-128 SOURce 22-129 STATistics 22-130 TEDGe 22-131 TIEClock2 22-133 TIEData 22-135 TMAX 22-137 TMIN 22-138 TVOLt 22-139 UNITinterval 22-141 VAMPlitude 22-143 VAVerage 22-144 VBASe 22-146 VLOWer 22-148 VMAX 22-149
Contents-10
VMIDdle 22-151 VMIN 22-152 VPP 22-154 VRMS 22-156 VTIMe 22-158 VTOP 22-159 VUPPer 22-161
23 Root Level Commands
ADER? (Acquisition Done Event Register) 23-4 AER? (Arm Event Register) 23-5 ATER? (Auto Trigger Event Register) 23-6 AUToscale 23-7 BEEP 23-8 BLANk 23-9 CDISplay 23-10 DIGitize 23-11 MTEE 23-12 MTER? 23-13 MODel? 23-14 OPEE 23-15 OPER? 23-16 OVLRegister? 23-17 PRINt 23-18 RECall:SETup 23-19 RUN 23-20 SERial (Serial Number) 23-21 SINGle 23-22 STATus? 23-23 STOP 23-24 STORe:JITTer 23-25 STORe:SETup 23-26 STORe:WAVeform 23-27 TER? (Trigger Event Register) 23-28 VIEW 23-29
Contents
24 Self-Test Commands
CANCel 24-3 SCOPETEST 24-4
25 System Commands
DATE 25-3 DEBug 25-4 DSP 25-6 ERRor? 25-7 HEADer 25-8
Contents-11
Contents
LOCK 25-10 LONGform 25-11 PRESet 25-13 SETup 25-14 TIME 25-16
26 Time Base Commands
POSition 26-3 RANGe 26-4 REFClock 26-5 REFerence 26-6 ROLL:ENABLE 26-7 SCALe 26-8 VIEW 26-9 WINDow:DELay 26-10 WINDow:POSition 26-12 WINDow:RANGe 26-13 WINDow:SCALe 26-14
27 Trigger Commands
Organization of Trigger Modes and Commands 27-5
Summary of Trigger Modes and Commands 27-6
Trigger Modes 27-8 HOLDoff 27-9 HTHReshold 27-10 HYSTeresis 27-11 LEVel 27-12 LTHReshold 27-13 SWEep 27-14
Edge Trigger Mode and Commands 27-15
EDGE:SLOPe 27-17 EDGE:SOURce 27-18
Glitch Trigger Mode and Commands 27-19
GLITch:POLarity 27-21 GLITch:SOURce 27-22 GLITch:WIDTh 27-23
Advanced COMM Trigger Mode and Commands 27-24
COMM:BWIDth 27-25 COMM:ENCode 27-26 COMM:LEVel 27-27
Contents-12
COMM:PATTern 27-28 COMM:POLarity 27-29 COMM:SOURce 27-30
Advanced Pattern Trigger Mode and Commands 27-31
PATTern:CONDition 27-33 PATTern:LOGic 27-34 PATTern:THReshold:LEVel 27-35
Advanced State Trigger Mode and Commands 27-36
STATe:CLOCk 27-38 STATe:LOGic 27-39 STATe:LTYPe 27-40 STATe:SLOPe 27-41 STATe:THReshold:LEVel 27-42
Advanced Delay By Event Mode and Commands 27-43
EDLY:ARM:SOURce 27-45 EDLY:ARM:SLOPe 27-46 EDLY:EVENt:DELay 27-47 EDLY:EVENt:SOURce 27-48 EDLY:EVENt:SLOPe 27-49 EDLY:TRIGger:SOURce 27-50 EDLY:TRIGger:SLOPe 27-51
Contents
Advanced Delay By Time Mode and Commands 27-52
TDLY:ARM:SOURce 27-54 TDLY:ARM:SLOPe 27-55 TDLY:DELay 27-56 TDLY:TRIGger:SOURce 27-57 TDLY:TRIGger:SLOPe 27-58
Advanced Standard TV Mode and Commands 27-59
STV:FIELd 27-61 STV:LINE 27-62 STV:SOURce 27-63 STV:SPOLarity 27-64
Advanced User Defined TV Mode and Commands 27-65
UDTV:ENUMber 27-67 UDTV:PGTHan 27-68 UDTV:POLarity 27-69 UDTV:SOURce 27-70
Contents-13
Contents
Advanced Trigger Violation Modes 27-71
VIOLation:MODE 27-72
Pulse Width Violation Mode and Commands 27-73
VIOLation:PWIDth:DIRection 27-75 VIOLation:PWIDth:POLarity 27-76 VIOLation:PWIDth:SOURce 27-77 VIOLation:PWIDth:WIDTh 27-78
Setup Violation Mode and Commands 27-79
VIOLation:SETup:MODE 27-82 VIOLation:SETup:SETup:CSOurce 27-83 VIOLation:SETup:SETup:CSOurce:EDGE 27-84 VIOLation:SETup:SETup:CSOurce:LEVel 27-85 VIOLation:SETup:SETup:DSOurce 27-86 VIOLation:SETup:SETup:DSOurce:HTHReshold 27-87 VIOLation:SETup:SETup:DSOurce:LTHReshold 27-88 VIOLation:SETup:SETup:TIME 27-89 VIOLation:SETup:HOLD:CSOurce 27-90 VIOLation:SETup:HOLD:CSOurce:EDGE 27-91 VIOLation:SETup:HOLD:CSOurce:LEVel 27-92 VIOLation:SETup:HOLD:DSOurce 27-93 VIOLation:SETup:HOLD:DSOurce:HTHReshold 27-94 VIOLation:SETup:HOLD:DSOurce:LTHReshold 27-95 VIOLation:SETup:HOLD:TIME 27-96 VIOLation:SETup:SHOLd:CSOurce 27-97 VIOLation:SETup:SHOLd:CSOurce:EDGE 27-98 VIOLation:SETup:SHOLd:CSOurce:LEVel 27-99 VIOLation:SETup:SHOLd:DSOurce 27-100 VIOLation:SETup:SHOLd:DSOurce:HTHReshold 27-101 VIOLation:SETup:SHOLd:DSOurce:LTHReshold 27-102 VIOLation:SETup:SHOLd:HoldTIMe (HTIMe) 27-103 VIOLation:SETup:SHOLd:SetupTIMe (STIMe) 27-104
Transition Violation Mode 27-105
VIOLation:TRANsition 27-107 VIOLation:TRANsition:SOURce 27-108 VIOLation:TRANsition:SOURce:HTHReshold 27-109 VIOLation:TRANsition:SOURce:LTHReshold 27-110 VIOLation:TRANsition:TYPE 27-111
28 Waveform Commands
BANDpass? 28-5 BYTeorder 28-6
Contents-14
COMPlete? 28-7 COUNt? 28-8 COUPling? 28-9 DATA? 28-10 FORMat 28-30 POINts? 28-33 PREamble 28-34 SEGMented:COUNt? 28-40 SEGMented:TTAG? 28-41 SOURce 28-42 TYPE? 28-43 VIEW 28-44 XDISplay? 28-46 XINCrement? 28-47 XORigin? 28-48 XRANge? 28-49 XREFerence? 28-50 XUNits? 28-51 YDISplay? 28-52 YINCrement? 28-53 YORigin? 28-54 YRANge? 28-55 YREFerence? 28-56 YUNits? 28-57
Contents
29 Waveform Memory Commands
DISPlay 29-3 LOAD 29-4 SAVE 29-5 XOFFset 29-6 XRANge 29-7 YOFFset 29-8 YRANge 29-9
30 Error Messages
Error Queue 30-3 Error Numbers 30-4 Command Error 30-5 Execution Error 30-6 Device- or Oscilloscope-Specific Error 30-7 Query Error 30-8 List of Error Messages 30-9
Contents-15
Contents-16
1

Introduction to Programming

Introduction to Programming
This chapter introduces the basics for remote programming of an oscilloscope. The programming commands in this manual conform to the IEEE 488.2 Standard Digital Interface for Programmable Instrumentation. The programming commands provide the means of remote control.
Basic operations that you can do with a computer and an oscilloscope include:
• Set up the oscilloscope.
• Make measurements.
• Get data (waveform, measurements, and configuration) from the oscilloscope.
• Send information, such as waveforms and configurations, to the oscilloscope.
You can accomplish other tasks by combining these functions.
Example Programs are Written in HP BASIC and C
The programming examples for individual commands in this manual are written in HP BASIC and C.
1-2
Introduction to Programming

Communicating with the Oscilloscope

Communicating with the Oscilloscope
Computers communicate with the oscilloscope by sending and receiving messages over a remote interface, such as a GPIB card or a Local Area Network (LAN) card. Commands for programming normally appear as ASCII character strings embedded inside the output statements of a “host” language available on your computer. The input commands of the host language are used to read responses from the oscilloscope.
For example, HP BASIC uses the OUTPUT statement for sending commands and queries. After a query is sent, the response is usually read using the HP BASIC ENTER statement. The ENTER statement passes the value across the bus to the computer and places it in the designated variable.
For the GPIB interface, messages are placed on the bus using an output command and passing the device address, program message, and a terminator. Passing the device address ensures that the program message is sent to the correct GPIB interface and GPIB device.
The following HP BASIC OUTPUT statement sends a command that sets the channel 1 scale value to 500 mV:
OUTPUT <device address> ;":CHANNEL1:SCALE 500E­3"<terminator>
The device address represents the address of the device being programmed. Each of the other parts of the above statement are explained on the following pages.
Use the Suffix Multiplier Instead
Using "mV" or "V" following the numeric voltage value in some commands will cause Error 138 - Suffix not allowed. Instead, use the convention for the suffix multiplier as described in chapter 3, "Message Communication and System Functions."
1-3
Introduction to Programming Output Command

Output Command

The output command depends entirely on the programming language. Throughout this book, HP BASIC and ANSI C are used in the examples of individual commands. If you are using other languages, you will need to find the equivalents of HP BASIC commands like OUTPUT, ENTER, and CLEAR, to convert the examples.

Device Address

The location where the device address must be specified depends on the programming language you are using. In some languages, it may be specified outside the OUTPUT command. In HP BASIC, it is always specified after the keyword, OUTPUT. The examples in this manual assume that the oscilloscope and interface card are at GPIB device address 707. When writing programs, the device address varies according to how the bus is configured.

Instructions

Instructions, both commands and queries, normally appear as strings embedded in a statement of your host language, such as BASIC, Pascal, or C. The only time a parameter is not meant to be expressed as a string is when the instruction's syntax definition specifies <block data>, such as HP BASIC’s "learnstring" command. There are only a few instructions that use block data.
Instructions are composed of two main parts:
• The header, which specifies the command or query to be sent.
• The program data, which provides additional information to clarify the meaning of the instruction.

Instruction Header

The instruction header is one or more command mnemonics separated by colons (:). They represent the operation to be performed by the oscilloscope. See the “Programming Conventions” chapter for more information.
Queries are formed by adding a question mark (?) to the end of the header. Many instructions can be used as either commands or queries, depending on whether or not you include the question mark. The command and query forms of an instruction usually have different program data. Many queries do not use any program data.
1-4
Introduction to Programming

White Space (Separator)

White Space (Separator)
White space is used to separate the instruction header from the program data. If the instruction does not require any program data parameters, you do not need to include any white space. In this manual, white space is defined as one or more spaces. ASCII defines a space to be character 32 in decimal.

Braces

When several items are enclosed by braces, { }, only one of these elements may be selected. Vertical line ( | ) indicates "or". For example, {ON | OFF} indicates that only ON or OFF may be selected, not both.

Ellipsis

... An ellipsis (trailing dots) indicates that the preceding element may be repeated one or more times.

Square Brackets

Items enclosed in square brackets, [ ], are optional.

Command and Query Sources

Many commands and queries require that a source be specified. Depending on the command or query and the model number of Infiniium oscilloscope being used, some of the sources are not available. The following is a list of sources:
CHANnel1 FUNCtion1 WMEMory1
CHANnel2 FUNCtion2 WMEMory2
CHANnel3 FUNCtion3 WMEMory3
CHANnel4 FUNCtion4 WMEMory4
DIGital0 DIGital1 DIGital2 DIGital3
DIGital4 DIGital5 DIGital6 DIGital7
DIGital8 DIGital9 DIGital10 DIGital11
DIGital12 DIGital13 DIGital14 DIGital15
CLOCk MTRend MSPectrum HISTogram
1-5
Introduction to Programming Program Data

Program Data

Program data is used to clarify the meaning of the command or query. It provides necessary information, such as whether a function should be on or off, or which waveform is to be displayed. Each instruction's syntax definition shows the program data and the values they accept.
When there is more than one data parameter, they are separated by commas (,). You can add spaces around the commas to improve readability.
1-6
Introduction to Programming

Header Types

Header Types
There are three types of headers:
• Simple Command headers
• Compound Command headers
• Common Command headers
Simple Command Header
Simple command headers contain a single mnemonic. AUTOSCALE and DIGITIZE are examples of simple command headers typically used in this oscilloscope. The syntax is:
<program mnemonic><terminator>
or
OUTPUT 707;”:AUTOSCALE”
When program data must be included with the simple command header (for example, :DIGITIZE CHAN1), white space is added to separate the data from the header. The syntax is:
<program mnemonic><separator><program data><terminator>
or
OUTPUT 707;”:DIGITIZE CHANNEL1,FUNCTION2”
Compound Command Header
Compound command headers are a combination of two program mnemonics. The first mnemonic selects the subsystem, and the second mnemonic selects the function within that subsystem. The mnemonics within the compound message are separated by colons. For example:
To execute a single function within a subsystem:
:<subsystem>:<function><separator><program data><terminator>
For example:
OUTPUT 707;”:CHANNEL1:BWLIMIT ON”
1-7
Introduction to Programming Header Types
Combining Commands in the Same Subsystem
To execute more than one command within the same subsystem, use a semi­colon (;) to separate the commands:
:<subsystem>:<command><separator><data>;<command><separator> <data><terminator>
For example:
:CHANNEL1:INPUT DC;BWLIMIT ON
Common Command Header
Common command headers, such as clear status, control the IEEE 488.2 functions within the oscilloscope. The syntax is:
*<command header><terminator>
No space or separator is allowed between the asterisk (*) and the command header. *CLS is an example of a common command header.
1-8
Introduction to Programming

Duplicate Mnemonics

Duplicate Mnemonics
Identical function mnemonics can be used for more than one subsystem. For example, you can use the function mnemonic RANGE to change both the vertical range and horizontal range:
To set the vertical range of channel 1 to 0.4 volts full scale:
:CHANNEL1:RANGE .4
To set the horizontal time base to 1 second full scale:
:TIMEBASE:RANGE 1
In these examples, CHANNEL1 and TIMEBASE are subsystem selectors, and determine the range type being modified.
1-9
Introduction to Programming Query Headers

Query Headers

A command header immediately followed by a question mark (?) is a query. After receiving a query, the oscilloscope interrogates the requested subsystem and places the answer in its output queue. The answer remains in the output queue until it is read or until another command is issued. When read, the answer is transmitted across the bus to the designated listener (typically a computer). For example, the query:
:TIMEBASE:RANGE?
places the current time base setting in the output queue. In HP BASIC, the computer input statement:
ENTER < device address > ;Range
passes the value across the bus to the computer and places it in the variable Range.
You can use queries to find out how the oscilloscope is currently configured and to get results of measurements made by the oscilloscope. For example, the command:
:MEASURE:RISETIME?
tells the oscilloscope to measure the rise time of your waveform and place the result in the output queue.
The output queue must be read before the next program message is sent. For example, when you send the query :MEASURE:RISETIME?, you must follow it with an input statement. In HP BASIC, this is usually done with an ENTER statement immediately followed by a variable name. This statement reads the result of the query and places the result in a specified variable.
Handle Queries Properly
If you send another command or query before reading the result of a query, the output buffer is cleared and the current response is lost. This also generates a query-interrupted error in the error queue. If you execute an input statement before you send a query, it will cause the computer to wait indefinitely.
1-10
Loading...
+ 890 hidden pages