Agilent 54831B Programmer’s Reference

Programmer’s Reference
Publication Number 54830-97014 March 2005
This reference applies directly to software revision code A.04.00 and later.
Copyright Agilent Technologies 2001-2005 All Rights Reserved.
54830 Series Infiniium Oscilloscopes

In This Book

This book is your guide to programming the Infiniium Series Oscilloscopes. Chapters 1-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-25 describe the commands used to program the Infiniium 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
BUS MARKer
CALibration MEASure
CHANnel POD
Common Root Level
DIGital
DISK SYSTem
DISPlay TIMe Base
EXTernal Channel TRIGger
FUNCtion WAVeform
HARDcopy Waveform MEMory
HISTogram
SELFtest
Error Messages chapter describes error messages.
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 Bus Commands 2-10
Contents-1
Contents
3 Message Communication and System Functions
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 Programming Conventions
Truncation Rule 5-3 The Command Tree 5-4 Infinity Representation 5-14 Sequential and Overlapped Commands 5-14 Response Generation 5-14 EOI 5-14
6 Sample Programs
Sample Program Structure 6-3 Sample C Programs 6-4 Listings of the Sample Programs 6-18 gpibdecl.h Sample Header 6-19 srqagi.c Sample Program 6-21 learnstr.c Sample Program 6-23 sicl_IO.c Sample Program 6-27 natl_IO.c Sample Program 6-32 init.bas Sample Program 6-37 srq.bas Sample Program 6-45
Contents-2
lrn_str.bas Sample Program 6-51
7 Acquire Commands
AVERage 7-3 AVERage:COUNt 7-4 COMPlete 7-5 COMPlete:STATe 7-7 INTerpolate 7-8 MODE 7-9 POINts 7-11 POINts:AUTO 7-21 SEGMented:COUNt 7-22 SEGMented:INDex 7-23 SRATe (Sample RATe) 7-24 SRATe:AUTO 7-26
8 Bus Commands
BIT<M> 8-3 BITS 8-4 CLEar 8-5 DISPlay 8-6 LABel 8-7
Contents
9 Calibration Commands
Oscilloscope Calibration 9-3 Probe Calibration 9-4
Calibration Commands 9-5 OUTPut 9-6
SKEW 9-7 STATus? 9-8
10 Channel Commands
BWLimit 10-3 DISPlay 10-4 INPut 10-5 OFFSet 10-6 PROBe 10-7 PROBe:ATTenuation 10-9 PROBe:EADapter 10-10 PROBe:ECoupling 10-12 PROBe:EXTernal 10-14
Contents-3
Contents
PROBe:EXTernal:GAIN 10-15 PROBe:EXTernal:OFFSet 10-17 PROBe:EXTernal:UNITs 10-19 PROBe:GAIN 10-21 PROBe:ID? 10-22 PROBe:SKEW 10-24 PROBe:STYPe 10-25 RANGe 10-26 SCALe 10-27 UNITs 10-28
11 Common Commands
*CLS (Clear Status) 11-4 *ESE (Event Status Enable) 11-5 *ESR? (Event Status Register) 11-7 *IDN? (Identification Number) 11-9 *LRN? (Learn) 11-11 *OPC (Operation Complete) 11-13 *OPT? (Option) 11-14 *PSC (Power-on Status Clear) 11-15 *RCL (Recall) 11-16 *RST (Reset) 11-17 *SAV (Save) 11-18 *SRE (Service Request Enable) 11-19 *STB? (Status Byte) 11-21 *TRG (Trigger) 11-23 *TST? (Test) 11-24 *WAI (Wait) 11-25
12 Digital Commands
DISPlay 12-3 LABel 12-4 SIZE 12-5 THReshold 12-6
13 Disk Commands
CDIRectory 13-3 DELete 13-4 DIRectory? 13-5 LOAD 13-6 MDIRectory 13-7 MSTore 13-8
Contents-4
PWD? 13-12 SEGMented 13-13 SIMage 13-14 STORe 13-15
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 External Trigger Commands
BWLimit 15-3 INPut 15-4 PROBe 15-5 PROBe:ATTenuation 15-6 PROBe:EADapter 15-7 PROBe:ECoupling 15-9 PROBe:EXTernal 15-11 PROBe:EXTernal:GAIN 15-12 PROBe:EXTernal:UNITs 15-14 PROBe:GAIN 15-16 PROBe:ID? 15-17 PROBe:SKEW 15-18 RANGe 15-19 UNITs 15-20
16 Function Commands
FUNCtion<N>? 16-4 ADD 16-5 AVERage 16-6 COMMonmode 16-7
Contents-5
Contents
DIFF (Differentiate) 16-8 DISPlay 16-9 DIVide 16-10 FFT:FREQuency 16-11 FFT:RESolution? 16-12 FFT:WINDow 16-13 FFTMagnitude 16-15 FFTPhase 16-16 FFTPhase 16-17 HIGHpass 16-18 HORizontal:POSition 16-19 HORizontal:RANGe 16-20 INTegrate 16-21 INVert 16-22 LOWPass 16-23 MAGNify 16-24 MAXimum 16-25 MAXimum 16-26 MINimum 16-27 MULTiply 16-28 OFFSet 16-29 RANGe 16-30 SMOoth 16-31 SUBTract 16-32 VERSus 16-33 VERTical 16-34 VERTical:OFFSet 16-35 VERTical:RANGe 16-36
17 Hardcopy Commands
AREA 17-3 DPRinter 17-4 FACTors 17-6 IMAGe 17-7 PRINters? 17-8
18 Histogram Commands
AXIS 18-4 MODE 18-5 SCALe:SIZE 18-6 WINDow:DEFault 18-7 WINDow:SOURce 18-8
Contents-6
WINDow:X1Position | LLIMit 18-9 WINDow:X2Position | RLIMit 18-10 WINDow:Y1Position | BLIMit 18-11 WINDow:Y2Position | TLIMit 18-12
19 Marker Commands
CURSor? 19-3 MEASurement:READout 19-4 MODE 19-5 TDELta? 19-6 TSTArt 19-7 TSTOp 19-9 VDELta? 19-11 VSTArt 19-12 VSTOp 19-14 X1Position 19-16 X2Position 19-17 X1Y1source 19-18 X2Y2source 19-19 XDELta? 19-20 Y1Position 19-21 Y2Position 19-22 YDELta? 19-23
Contents
20 Mask Test Commands
ALIGn 20-4 AlignFIT 20-5 AMASk:CREate 20-7 AMASk:SOURce 20-8 AMASk:[SAVE | STORe] 20-9 AMASk:UNITs 20-10 AMASk:XDELta 20-11 AMASk:YDELta 20-13 AUTO 20-15 AVERage 20-16 AVERage:COUNt 20-17 COUNt:FAILures? 20-18 COUNt:FWAVeforms? 20-19 COUNt:WAVeforms? 20-20 DELete 20-21 ENABle 20-22 FOLDing 20-23
Contents-7
Contents
FOLDing:BITS 20-24 HAMPlitude 20-25 IMPedance 20-26 INVert 20-28 LAMPlitude 20-29 LOAD 20-30 NREGions? 20-31 PROBe:IMPedance? 20-32 RUMode 20-33 RUMode:SOFailure 20-35 SCALe:BIND 20-36 SCALe:X1 20-37 SCALe:XDELta 20-38 SCALe:Y1 20-40 SCALe:Y2 20-41 SOURce 20-42 STARt | STOP 20-43 STIMe 20-44 TITLe? 20-45 TRIGger:SOURce 20-46
21 Measure Commands
AREA 21-7 CGRade:CROSsing 21-8 CGRade:DCDistortion 21-9 CGRade:EHEight 21-10 CGRade:EWIDth 21-11 CGRade:JITTer 21-12 CGRade:QFACtor 21-13 CLEar 21-14 CLOCk 21-15 CLOCk:METHod 21-16 CLOCk::VERTical 21-18 CLOCk::VERTical:OFFSet 21-19 CLOCk:VERTical:RANGe 21-20 CTCDutycycle 21-21 CTCJitter 21-23 CTCNwidth 21-25 CTCPwidth 21-26 DATarate 21-27 DEFine 21-29 DELTatime 21-34 DUTYcycle 21-36
Contents-8
FALLtime 21-38 FFT:DFRequency 21-40 FFT:DMAGnitude 21-41 FFT:FREQuency 21-42 FFT:MAGNitude 21-43 FFT:PEAK1 21-44 FFT:PEAK2 21-45 FFT:THReshold 21-46 FREQuency 21-47 HISTogram:HITS 21-49 HISTogram:M1S 21-51 HISTogram:M2S 21-53 HISTogram:M3S 21-55 HISTogram:MAX? 21-57 HISTogram:MEAN? 21-58 HISTogram:MEDian? 21-59 HISTogram:MIN? 21-60 HISTogram:PEAK? 21-61 HISTogram:PP? 21-62 HISTogram:STDDev? 21-63 HOLDtime 21-64 JITTer:MEASurement 21-66 JITTer:SPECtrum 21-67 JITTer:SPECtrum:HORizontal 21-68 JITTer:SPECtrum:HORizontal:POSition 21-69 JITTer:SPECtrum:HORizontal:RANGe 21-71 JITTer:SPECtrum:VERTical 21-72 JITTer:SPECtrum:VERTical:OFFSet 21-73 JITTer:SPECtrum:VERTical:RANGe 21-74 JITTer:SPECtrum:WINDow 21-75 JITTer:STATistics 21-76 JITTer:TRENd 21-77 JITTer:TRENd:SMOoth 21-78 JITTer:TREND:SMOoth:POINts 21-79 JITTer:TRENd:VERTical 21-80 JITTer:TRENd:VERTical:OFFSet 21-81 JITTer:TRENd:VERTical:RANGe 21-82 NCJitter 21-83 NWIDth 21-85 OVERshoot 21-87 PERiod 21-89 PHASe 21-91 PREShoot 21-93
Contents
Contents-9
Contents
PWIDth 21-95 RESults? 21-97 RISetime 21-100 SCRatch 21-102 SENDvalid 21-103 SETuptime 21-104 SOURce 21-106 STATistics 21-107 TEDGe 21-108 TIEClock2 21-110 TIEData 21-112 TMAX 21-114 TMIN 21-115 TVOLt 21-116 UNITinterval 21-118 VAMPlitude 21-120 VAVerage 21-121 VBASe 21-123 VLOWer 21-125 VMAX 21-126 VMIDdle 21-128 VMIN 21-129 VPP 21-131 VRMS 21-133 VTIMe 21-135 VTOP 21-136 VUPPer 21-138
22 Pod Commands
DISPlay 22-3 THReshold 22-4 PSKew 22-5
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 BLANk 23-8 CDISplay 23-9 DIGitize 23-10 DISable 23-12
Contents-10
ENABle 23-13 MTEE 23-14 MTER? 23-15 MODel? 23-16 OPEE 23-17 OPER? 23-18 OVLEnable 23-19 OVLRegister? 23-20 PRINt 23-21 RECall:SETup 23-22 RUN 23-23 SERial (Serial Number) 23-24 SINGle 23-25 STATus? 23-26 STOP 23-27 STORe:SETup 23-28 STORe:WAVeform 23-29 TER? (Trigger Event Register) 23-30 VIEW 23-31
Contents
24 Self-Test Commands
AttenSET? 24-3 CANCel 24-4 SCOPETEST 24-5
25 System Commands
DATE 25-3 DEBug 25-4 DSP 25-6 ERRor? 25-7 HEADer 25-8 LOCK 25-10 LONGform 25-11 SETup 25-13 TIME 25-15
26 Time Base Commands
POSition 26-3 RANGe 26-4 REFerence 26-5 ROLL:ENABLE 26-6 SCALe 26-7
Contents-11
Contents
VIEW 26-8 WINDow:DELay 26-9 WINDow:POSition 26-11 WINDow:RANGe 26-12 WINDow:SCALe 26-13
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:COUPling 27-17
EDGE:SLOPe 27-18 EDGE:SOURce 27-19
Glitch Trigger Mode and Commands 27-20 GLITch:POLarity 27-22
GLITch:SOURce 27-23 GLITch:WIDTh 27-24
Advanced COMM Trigger Mode and Commands 27-25 COMM:BWIDth 27-26
COMM:ENCode 27-27 COMM:LEVel 27-28 COMM:PATTern 27-29 COMM:POLarity 27-30 COMM:SOURce 27-31
Advanced Pattern Trigger Mode and Commands 27-32 PATTern:CONDition 27-34
PATTern:LOGic 27-35 :PATTern:THReshold:LEVel 27-36 :PATTern:THReshold:POD<N> 27-37
Contents-12
Advanced State Trigger Mode and Commands 27-38 STATe:CLOCk 27-40
STATe:LOGic 27-41 STATe:LTYPe 27-42 STATe:SLOPe 27-43 :STATe:THReshold:LEVel 27-44
Advanced Delay By Event Mode and Commands 27-45 EDLY:ARM:SOURce 27-47
EDLY:ARM:SLOPe 27-48 EDLY:EVENt:DELay 27-49 EDLY:EVENt:SOURce 27-50 EDLY:EVENt:SLOPe 27-51 EDLY:TRIGger:SOURce 27-52 EDLY:TRIGger:SLOPe 27-53
Advanced Delay By Time Mode and Commands 27-54 TDLY:ARM:SOURce 27-56
TDLY:ARM:SLOPe 27-57 TDLY:DELay 27-58 TDLY:TRIGger:SOURce 27-59 TDLY:TRIGger:SLOPe 27-60
Contents
Advanced Standard TV Mode and Commands 27-61 STV:FIELd 27-63
STV:LINE 27-64 STV:SOURce 27-65 STV:SPOLarity 27-66
Advanced User Defined TV Mode and Commands 27-67 UDTV:ENUMber 27-69
UDTV:PGTHan 27-70 UDTV:POLarity 27-71 UDTV:SOURce 27-72
Advanced Trigger Violation Modes 27-73 VIOLation:MODE 27-74
Pulse Width Violation Mode and Commands 27-75 VIOLation:PWIDth:DIRection 27-77
VIOLation:PWIDth:POLarity 27-78 VIOLation:PWIDth:SOURce 27-79
Contents-13
Contents
VIOLation:PWIDth:WIDTh 27-80
Setup Violation Mode and Commands 27-81 VIOLation:SETup:MODE 27-84
VIOLation:SETup:SETup:CSOurce 27-85 VIOLation:SETup:SETup:CSOurce:LEVel 27-86 VIOLation:SETup:SETup:CSOurce:EDGE 27-87 VIOLation:SETup:SETup:DSOurce 27-88 VIOLation:SETup:SETup:DSOurce:HTHReshold 27-89 VIOLation:SETup:SETup:DSOurce:LTHReshold 27-90 VIOLation:SETup:SETup:TIME 27-91 VIOLation:SETup:HOLD:CSOurce 27-92 VIOLation:SETup:HOLD:CSOurce:LEVel 27-93 VIOLation:SETup:HOLD:CSOurce:EDGE 27-94 VIOLation:SETup:HOLD:DSOurce 27-95 VIOLation:SETup:HOLD:DSOurce:HTHReshold 27-96 VIOLation:SETup:HOLD:DSOurce:LTHReshold 27-97 VIOLation:SETup:HOLD:TIME 27-98 VIOLation:SETup:SHOLd:CSOurce 27-99 VIOLation:SETup:SHOLd:CSOurce:LEVel 27-100 VIOLation:SETup:SHOLd:CSOurce:EDGE 27-101 VIOLation:SETup:SHOLd:DSOurce 27-102 VIOLation:SETup:SHOLd:DSOurce:HTHReshold 27-103 VIOLation:SETup:SHOLd:DSOurce:LTHReshold 27-104 VIOLation:SETup:SHOLd:SetupTIMe (STIMe) 27-105 VIOLation:SETup:SHOLd:HoldTIMe (HTIMe) 27-106
Transition Violation Mode 27-107 VIOLation:TRANsition 27-109
VIOLation:TRANsition:SOURce 27-110 VIOLation:TRANsition:SOURce:HTHReshold 27-111 VIOLation:TRANsition:SOURce:LTHReshold 27-112 VIOLation:TRANsition:TYPE 27-113
28 Waveform Commands
BANDpass? 28-5 BYTeorder 28-6 COMPlete? 28-7 COUNt? 28-8 COUPling? 28-9 DATA? 28-10 DATA? Example for Analog Channels 28-12 DATA? Example for Digital Channels 28-26
Contents-14
FORMat 28-41 POINts? 28-44 PREamble 28-45 SEGMented:COUNt? 28-51 SEGMented:TTAG? 28-52 SOURce 28-53 TYPE? 28-55 VIEW 28-57 XDISplay? 28-59 XINCrement? 28-60 XORigin? 28-61 XRANge? 28-62 XREFerence? 28-63 XUNits? 28-64 YDISplay? 28-65 YINCrement? 28-66 YORigin? 28-67 YRANge? 28-68 YREFerence? 28-69 YUNits? 28-70
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
Introduction to Programming

Program Header Options

Program Header Options
You can send program headers using any combination of uppercase or lowercase ASCII characters. Oscilloscope responses, however, are always returned in uppercase.
You may send program command and query headers in either long form (complete spelling), short form (abbreviated spelling), or any combination of long form and short form. For example:
:TIMEBASE:DELAY 1E-6 is the long form. :TIM:DEL 1E-6 is the short form.
Using Long Form or Short Form
Programs written in long form are easily read and are almost self-documenting. The short form syntax conserves the amount of computer memory needed for program storage and reduces I/O activity.
The rules for the short form syntax are described in the chapter, “Programming Conventions.”

Character Program Data

Character program data is used to convey parameter information as alpha or alphanumeric strings. For example, the :TIMEBASE:REFERENCE command can be set to left, center, or right. The character program data in this case may be LEFT, CENTER, or RIGHT. The command :TIMEBASE:REFERENCE RIGHT sets the time base reference to right.
The available mnemonics for character program data are always included with the instruction's syntax definition. You may send either the long form of commands, or the short form (if one exists). You may mix uppercase and lowercase letters freely. When receiving responses, uppercase letters are used exclusively.
1-11
Introduction to Programming

Numeric Program Data

Numeric Program Data
Some command headers require program data to be expressed numerically. For example, :TIMEBASE:RANGE requires the desired full-scale range to be expressed numerically.
For numeric program data, you can use exponential notation or suffix multipliers to indicate the numeric value. The following numbers are all equal:
28 = 0.28E2 = 280E-1 = 28000m = 0.028K = 28E-3K When a syntax definition specifies that a number is an integer, it means that the
number should be whole. Any fractional part is ignored and truncated. Numeric data parameters that accept fractional values are called real numbers. For more information see the chapter, “Interface Functions.”
All numbers are expected to be strings of ASCII characters.
• When sending the number 9, you would send a byte representing the
ASCII code for the character “9” (which is 57).
• A three-digit number like 102 would take up three bytes (ASCII codes 49,
48, and 50). The number of bytes is figured automatically when you include the entire instruction in a string.
1-12
Loading...
+ 844 hidden pages