Lecroy 9300 & LC Control

Remote Control
Remote Control
Remote ControlRemote Control Manual
Manual
ManualManual
LeCroy
LeCroy
LeCroyLeCroy 9300 & LC
9300 & LC
9300 & LC9300 & LC Oscilloscopes
OscilloscopesOscilloscopes
Revision P
Revision P
Revision PRevision P
LeCroy Corporation
LeCroy Corporation
LeCroy CorporationLeCroy Corporation
700 Chestnut Ridge Road Chestnut Ridge, NY 10977–6499 Tel: (845) 578 6020, Fax: (845) 578 5985
Internet:
Internet: www .lecroy.com
Internet:Internet:
© 2001 byLeCroyCorporation.Allrightsreserved.Informationinthispublicationsupersedesallearlierversions.Specifications subject to change.
LeCroy, ProBus and SMART Trigger are registered trademarks of LeCroy Corporation. Centronics is a registered trademark of Data Computer Corp. Epson is a registered trademark of Epson America Inc. I a registered trademark of The MathWorks, Inc. Microsoft, MS and Microsoft Access are registered trademarks, and Windows and NT trademarks, of Microsoft Corporation. PowerPC is a registered trademark of IBMMicroelectronics.DeskJet, ThinkJet, QuietJet, LaserJet, PaintJet, HP 7470 and HP 7550 are registered trademarks of Hewlett-Packard Company.
LCXXX-RM-E Rev P 0901
2
C is a trademark of Philips. Mathcad is a registeredtrademark of MATHSOFT Inc.MATLAB is
Chapter 1 — Overview of Remote C ontrol
Chapter 1 — Overview of Remote C ontrol
Chapter 1 — Overview of Remote C ontrolChapter 1 — Overview of Remote C ontrol
How to Operate the Oscilloscope Remotely
How to Operate the Oscilloscope Remotely............................1–1
How to Operate the Oscilloscope RemotelyHow to Operate the Oscilloscope Remotely
Chapter 2 — GPIB
Chapter 2 — GPIB
Chapter 2 — GPIBChapter 2 — GPIB
Communication via the GPIB Bus
Communication via the GPIB Bus..................................................2–1
Communication via the GPIB BusCommunication via the GPIB Bus Instrument Polls
Instrument Polls ..................................................................................2–13
Instrument PollsInstrument Polls Driving Hardcopy Devices on the GPIB
Driving Hardcopy Devices on the GPIB.....................................2–19
Driving Hardcopy Devices on the GPIBDriving Hardcopy Devices on the GPIB Printing by GPIB Controller
Printing by GPIB Controller.............................................................2–20
Printing by GPIB ControllerPrinting by GPIB Controller
Chapter 3 — RS-232-C
Chapter 3 — RS-232-C
Chapter 3 — RS-232-CChapter 3 — RS-232-C
Using the RS-232-C Port
Using the RS-232-C Port.....................................................................3–1
Using the RS-232-C PortUsing the RS-232-C Port Simulating GPIB Commands with RS-232-C
Simulating GPIB Commands with RS-232-C.............................3–6
Simulating GPIB Commands with RS-232-CSimulating GPIB Commands with RS-232-C
Chapter 4 — Waveform
Chapter 4 — Waveform
Chapter 4 — WaveformChapter 4 — Waveform
Understanding Waveforms
Understanding Waveforms................................................................4–1
Understanding WaveformsUnderstanding Waveforms Using the INSPECT? Query
Using the INSPECT? Query...............................................................4–4
Using the INSPECT? QueryUsing the INSPECT? Query WAVEFORM?, Related Commands, and Blocks
WAVEFORM?, Related Commands, and Blocks......................4–6
WAVEFORM?, Related Commands, and BlocksWAVEFORM?, Related Commands, and Blocks High-Speed Waveform Transfer
High-Speed Waveform Transfer....................................................4–15
High-Speed Waveform TransferHigh-Speed Waveform Transfer
Contents
Contents
ContentsContents
Chapter 5 — Status Regis ters
Chapter 5 — Status Regis ters
Chapter 5 — Status Regis tersChapter 5 — Status Regis ters
Using Status Registers
Using Status Registers.......................................................................5–1
Using Status RegistersUsing Status Registers
SYSTEM COMMANDS
SYSTEM COMMANDS
SYSTEM COMMANDSSYSTEM COMMANDS
About These Commands & Queries
About These Commands & Queries.....................................................1
About These Commands & QueriesAbout These Commands & Queries … Tabled By Long Form
… Tabled By Long Form .........................................................................3
… Tabled By Long Form… Tabled By Long Form … Tabled By Subsystem
… Tabled By Subsystem ........................................................................8
… Tabled By Subsystem… Tabled By Subsystem
The Commands and Queries
The Commands and Queries..............................................................12
The Commands and QueriesThe Commands and Queries
Appendix A — GPIB Program Examples
Appendix A — GPIB Program Examples
Appendix A — GPIB Program ExamplesAppendix A — GPIB Program Examples Appendix B — Waveform Template
Appendix B — Waveform Template
Appendix B — Waveform TemplateAppendix B — Waveform Template Index
Index
IndexIndex
LCXXX-RM-E Rev P ISSUED: September 2001 iii
BLANK PAGE
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
iv ISSUED: September 2001 LCXXX-RM-E Rev P
Overview of Remote Control
Overview of Remote Control
1111
How to Operate the Oscilloscope Remotely
How to Operate the Oscilloscope Remotely
How to Operate the Oscilloscope RemotelyHow to Operate the Oscilloscope Remotely
Your LeCroy oscilloscope can of course be operated
manually, using the front-panel controls (see the accompanying Operator’s Manual ). But it can also be
operated remotely by means of an external controller. Normally, this controller will be a computer. However, it may beasimpleterminal.
The present manual describes how to remotely control the oscilloscope. Its main section provides the system commands for executing the instrument’s functions from an external controller.
Remote control is done using either the GPIB (General Purpose Interface Bus) — labeled “IEEE Std 488-2” — or the RS-232-C communication port on the rear panel of the oscilloscope. The instrument can be fully controlled in remote mode, the only actions not able to be performed being the powering-on of the oscilloscope and the setting of remote addresses.
Illustrated above and below-right, the GPIB (IEEE Std 488-2)and RS-232-C ports found on the back of LeCroy oscilloscopes, used for connecting the instrument to an external controller. They are vertically or horizontally arranged on the back panel according to model.
In this chapter, the basic remote control concepts common to both GPIB and RS-232-C are introduced. Also presented is a brief description of the remote control messages. The following two chapters set out how to send program messages over the GPIB and RS-232-C interfaces, respectively. Chapter 4 offers a detailed description and run-through of the transfer and formatting of waveforms. While Chapter 5 explains the use of status bytes for error reporting.
The special System Commands section provides a complete directory and description of the system commands. And the Appendices offer GPIB Program Examples (Appendix A) and a Waveform Template (Appendix B).
Overview of Remote ControlOverview of Remote Control
GPIB Standard
GPIB Standard The remote com mands
GPIB StandardGPIB Standard
conform to the GPIB IEEE
*
488.2 which may be
* ANSI/IEEE Std. 488.2–1987, IEEE Standard Codes, Formats, Protocols, and Common
Commands. The Institute of Electrical and Electronics Engineers Inc., 345 East 47th Street,
New York, NY 10017, USA.
LCXXX-RM-E Rev P ISSUED: September 2001 1–1
standard,
About Remote Control
About Remote Control
About Remote ControlAbout Remote Control
considered as an extension of the IEEE 488.1 standard, dealing mainly with electrical and mechanical issues. The IEEE 488.2 recommendations have also been adopted for RS-232-C communications wherever applicable.
Program Messages
Program Messages To control the oscilloscope remotely, the program messages
Program MessagesProgram Messages
sent from the external controller must conform to precise format structures. The oscilloscope will execute all program messages sent in the correct form, but will ignore those where errors are detected.
Warning or error messages are normally not reported unless the controller explicitly examines the relevant status register. Or if the status-enable registers have been set so that the controller can be interrupted when an error occurs.
During the development of the control program it is possible to observe all remote control transactions, including error messages, on an external monitor connected to the RS-232-C port. Refer to the command “COMM_HELP” for further details.
Commands and Queries
Commands and Queries Program messages consist of either one or several commands
Commands and QueriesCommands and Queries
or queries. Whereas the command directs the instrument to change its state —
its timebase or vertical sensitivity, for example — the query asks the instrument about that state. Very often, the same mnemonic is used for a command and a query, the query being identified by a <?> after the last character.
For example, to change the timebase to 2 ms/div, the controller sends the following command to the instrument:
TIME_DIV 2 MS
To ask the instrument about its timebase, this query should be sent:
TIME_DIV?
A query causes the instrument to send a response message. The control program should read this message with a ‘read’ instruction to the GPIB or RS-232-C interface of the controller. The response message to the query above might be:
TIME_DIV 10 NS
1–2 ISSUED:September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
The portion of the query preceding the question mark is repeated as part of the response message. If desired, this text may be suppressed with the command “COMM_HEADER”.
Depending on the state of the instrument and the computation to be done, up to several seconds may pass before a response is received. Command interpretation does not have priority over other oscilloscope activities. It is therefore judicious to set the controller IO timeout conditions to three or more seconds. In addition, it should always be remembered that an incorrect query message will not generate a response message.
Program Message Form
Program Message Form An instrument is remotely controlled with program messages that
Program Message FormP rogram Mes sage For m
consist of one or several commands or queries, separated by semicolons <;> and ending in a terminator:
<command/query>;.........;<command/query>
<terminator>
Upper or lower-case characters or both can be used in program messages.
The instrument does not decode incoming program messages before receiving a terminator. The exception to this is when the program message is longer than the 256 byte input buffer: the oscilloscope will start analyzing the message when the buffer is full. Commands and queries are executed in the order in which they are transmitted.
In GPIB mode, the following are valid terminators:
<NL> New-line character (i.e. the ASCII new-
line character, whose decimal value is
10).
<NL> <EOI> New-line character with a simultaneous
<EOI> signal.
<EOI> <EOI> signal together with the last
character of the program message.
Note:
Note: The <EOI> signal is a dedicated GPIB interface line
Note:Note:
which can be set with a special call to the GPIB interface driver. Refer to the GPIB interface manufacturer’s manual and support programs.
LCXXX-RM-E Rev P ISSUED: September 2001 1–3
About Remote Control
About Remote Control
About Remote ControlAbout Remote Control
The <NL> <EOI> terminator is always used in response messages sent by the instrument to the controller.
In RS-232-C, the terminator may be defined by the user with the command “COMM_RS232”. The default value is <CR>, i.e. the ASCII carriage return character, the decimal value of which is 13.
Examples
Examples GRID DUAL
ExamplesExamples
This program message consists of a single command that instructs the instrument to display a dual grid. The terminator is not shown, as it is usually automatically added by the interface driver routine writing to the GPIB (or RS-232).
DZOM ON; DISPLAY OFF; DATE?
This program message consists of two commands, followed by a query. They instruct the instrument to turn on the multi-zoom mode, turn off the display, and then ask for the current date. Again, the terminator is not shown.
Command/Query Form
Command/Query Form The general form of a command or a query consists of a
Command/Query FormCommand/Query Form
command header <header> optionally followed by one or several parameters <data> separated by commas:
<header>[?] <data>,...,<data>
The notation [?] shows that the question mark is optional (turning the command into a query). The detailed listing of all commands in System Commands indicates which may also be queries. There is a space between the header and the first parameter. There are commas between parameters.
Example
Example DATE 15,JAN,1993,13,21,16
ExampleExample
This command instructs the oscilloscope to set its date and time to 15 JAN 1993, 13:21:16. The command header “DATE” indicates the action, the 6 data values specify it in detail.
Header
Header The header is the mnemonic form of the operation to be
HeaderHeader
performed by the oscilloscope. All command mnemonics are listed in alphabetic order in the System Commands section.
The majority of the command/query headers have a long form for optimum legibility and a short form for better transfer and decoding speed. The two forms are fully equivalent and can be
1–4 ISSUED:September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
used interchangeably. For example, the following two commands for switching to the automatic trigger mode are fully equivalent:
TRIG_MODE AUTO and TRMD AUTO
Some command/query mnemonics are imposed by the IEEE
488.2 standard. They are standardized so that different instruments present the same programming interface for similar functions. All these mnemonics begin with an asterisk <*>. For example, the command “*RST” is the IEEE 488.2 imposed mnemonic for resetting the instrument, whereas “*TST?” instructs the instrument to perform an internal self-test and to report the outcome.
Header path
Header path Some commands or queries apply to a sub-section of the
Header pathHeader path
oscilloscope — for example, a single input channel or a trace on the display. In such cases, the header must be preceded by a path name that indicates the channel or trace to which the command applies. The header path normally consists of a two­letter path name followed by a colon <:> immediately preceding the command header.
One of the waveform traces can usually be specified in the header path (refer to the individual commands listed in System Commands for details of the values applying to given command headers):
C1, C2 Channels 1 and 2 C3, C4 Channels 3 and 4 M1, M2, M3, M4 Memories 1, 2, 3, 4 TA, TB, TC, TD Traces A, B, C and D EX, EX10, EX5 External trigger LINE LINE source for trigger
Example
Example C1:OFST -300 MV
ExampleExample
Commands to set the offset of Channel 1 to 300 mV. Header paths need only be specified once. Subsequent
commands with header destinations not indicated are assumed to refer to the last defined path. For example, the following commands are identical:
On four-channel instruments only.
LCXXX-RM-E Rev P ISSUED: September 2001 1–5
About Remote Control
About Remote Control
About Remote ControlAbout Remote Control
C2:VDIV?; C2:OFST? What is the vertical sensitivity
and the offset of channel 2?
C2:VDIV?; OFST? Same as above, without
repeating the path.
Data
Data Whenever a command/query uses additional data values, the
DataData
values are expressed in terms of ASCII characters. There is a single exception: the transfer of waveforms with the command/query “WAVEFORM”, where the waveform may be expressed as a sequence of binary data values. Chapter 4 gives
a detailed explanation of waveform format.
ASCII data can have the form of character, numeric, string or block data.
Character data
Character data These are simple words or abbreviations for the indication of a
Character dataCharacter data
specific action.
Example
Example DUAL_ZOOM ON
ExampleExample
Here, the data value “ON” commands that the dual-zoom mode be turned on (the data value “OFF” in such a case will obviously have the opposite effect).
However, this can become more complex. In some commands, where as many as a dozen different parameters are able to be specified, or where not all the parameters are applicable at the same time, the format requires pairs of data values. The first value names the parameter to be modified, while the second gives its value. Only those parameter pairs changed need indicating:
Example
Example HARDCOPY_SETUP DEV,EPSON,PORT,GPIB
ExampleExample
Here, two pairs of parameters are specified. The first specifies the device as the EPSON printer (or compatible) and the second indicates the GPIB port. While the command “HARDCOPY_SETUP” allows many more parameters, they are either not relevant for printers or are left unchanged.
Numeric Data
Numeric Data The numeric data type is used to enter quantitative information.
Numeric DataNumeric Data
Numbers can be entered as integers or fractions, or in exponential representation:
1–6 ISSUED:September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
TA:VPOS -5 Move the displayed trace of
Trace A downwards by five divisions.
C2:OFST 3.56 Set the DC offset of Channel 2
to 3.56 V.
TDIV 5.0E-6 Adjust the timebase to 5 µs/div.
Note:
Note: Numeric values may be followed by multipliers and
Note:Note:
units, modifying the value of the numerical expression. The following mnemonics are recognized:
EX 1E18 Exa- PE 1E15 Peta­T 1E12 Tera- G 1E9 Giga­MA 1E6 Mega- K 1E3 kilo­M
N
F
Examples
Examples There are many ways of setting the timebase of the instrument to
ExamplesExamples
1E−−−3 1E−−−9
1E−−−15
milli- U
nano- PI
femto- A
1E−−−6 1E−−−12 1E−−−18
micro-
pico-
atto-
5µs/div:
TDIV 5E-6 Exponential notation, without any suffix. TDIV 5 US Suffix multiplier “U” for 1E6, with the
(optional) suffix “S” for seconds.
or
TDIV 5000 NS TDIV 5000E-3 US
String Data
String Data This data type enables the transfer of a (long) string of
String DataString Data
characters as a single parameter. String data are formed by simply enclosing any sequence of ASCII characters between single or double quotation marks:
LCXXX-RM-E Rev P ISSUED: September 2001 1–7
About Remote Control
About Remote Control
About Remote ControlAbout Remote Control
MESSAGE ‘Connect probe to point J3’
The instrument displays this message in the Message field above the grid.
Block Data
Block Data These are binary data values coded in hexadecimal ASCII, i.e.
Block DataBlock Data
4-bit nibbles translated into the digits 0,...9, A,...F and transmitted as ASCII characters. They are used only for the transfer of waveforms (Command “WAVEFORM”) and of the instrument configuration (Command “PANEL_SETUP”)
Response Message Form
Response Message Form The instrument sends a response message to the controller, as
Response Message FormResponse Message Form
an answer to a query. The format of such messages is the same as that of program messages, i.e. individual responses in the format of commands, separated by semicolons <;> and ending with a terminator. They can be sent back to the instrument in the form in which they are received, to be accepted as valid commands. In GPIB response messages, the <NL> <EOI> terminator is always used.
For instance, if the controller sends the program message:
TIME_DIV?;TRIG_MODE NORM;C1:COUPLING?
(terminator not shown).
The instrument might respond as follows:
TIME_DIV 50 NS;C1:COUPLING D50 (terminator not shown).
The response message refers only to the queries: “TRIG_MODE” is left out. If this response is sent back to the instrument, it is a valid program message for setting its timebase to 50 ns/div and the input coupling of Channel 1 to 50 W.
Whenever a response is expected from the instrument, the control program must instruct the GPIB or RS-232-C interface to read from the instrument. If the controller sends another program message without reading the response to the previous one, the response message in the output buffer of the instrument is discarded.
The instrument uses somewhat stricter rules for response messages than for the acceptance of program messages. Whereas the controller may send program messages in upper or lower case characters, response messages are always returned
1–8 ISSUED:September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
in upper case. Program messages may contain extraneous spaces or tabs (white space): response messages will not. And while program messages may contain a mixture of short and long command/query headers, response messages always use short headers by default.
However, the instrument can be forced, using the command “COMM_HEADER”, to use long headers, or no headers at all. If the response header is omitted, the response transfer time is minimized, but such a response will not be able to be sent back to the instrument. Suffix units are also suppressed in the response.
If the trigger slope of Channel 1 is set to negative, the query “C1:TRSL?” might yield the following responses:
C1:TRIG_SLOPE NEG header format: long C1:TRSL NEG header format: short NEG header format: off
Waveforms which are obtained from the instrument using the query “WAVEFORM?” constitute a special kind of response message. Their exact format can be controlled via the “COMM_FORMAT” and “COMM_ORDER” commands.
LCXXX-RM-E Rev P ISSUED: September 2001 1–9
GPIB
GPIB
2222
Communication via the GPIB Bus
Communication via the GPIB Bus
Communication via the GPIB BusCommunication via the GPIB Bus
This chapter describes how to remotely control the oscilloscope using the General Purpose Interface Bus (GPIB). Discussed are interface capabilities, addressing, standard bus commands, and polling schemes. See also the
“Utilities” chapter in the accompanying Operator’s Manual and “Hands-On Guide”.
GPIB Structure
GPIB Structure GPIB is similar to a standard computer bus. But whereas a
GPIB StructureGPIB Structure
computer interconnects circuit cards via a backplane bus, the GPIB interconnects independent devices by means of a cable bus. GPIB also carries both program and interface messages.
Program messages, often called device-dependent messages, contain programming instructions, measurement results, instrument status and waveform data. Their general
form is described in the previous chapter.
Interface messages manage the bus itself. They perform functions such as its initialization, the addressing and “unaddressing” of devices, and the setting of remote and local modes.
GPIBGPIB
Talkers and Listeners
Talkers and Listeners Devices connected by GPIB can be listeners, talkers, or
Talkers and ListenersT alker s and Li st eners
controllers. A talker sends program messages to one or more listeners, while the controller manages the flow of information on the bus by sending interface messages to the devices.
The oscilloscope can be a talker or listener, but not a controller. The host computer must be able to play all three roles.
Interface Capabilities
Interface Capabilities The interface capabilities of the oscilloscope include the following
Interface CapabilitiesInterface C apabilities
IEEE 488.1 definitions:
*
For details of how the controller configures the GPIB for specific functions, refer to the GPIB
interface manufacturer’s manual.
LCXXX-RM-E Rev P ISSUED: September 2001 2–1
*
GPIB
GPIB
GPIBGPIB
AH1 Complete Acceptor Handshake SH1 Complete Source Handshak e L4 Partial Listener Function T5 Complete T alker Function SR1 Complete Service Request Function RL1 Complete Remote/Local Function DC1 Complete Device Clear Function DT1 Com plete Device Trigger PP1 Parallel Polling: remote configurability C0 No Controller Functions E2 Tri-state Drivers
Addressing
Addressing Every device on the GPIB has an address. When the remote
AddressingAddressing
control port is set to “GPIB”, using the oscilloscope’s front-panel­operated “UTILITIES” menus, the instrument can be controlled via GPIB. When the remote control port is set to “RS-232” by the same means, the instrument will execute solely “talk-only” operations over the GPIB, such as driving a printer. Setting the oscilloscope to “RS-232” enables the instrument to be controlled via the RS-232-C port (see next chapter).
If the oscilloscope is addressed to talk, it will remain thus configured until receiving a universal untalk command (UNT), its own listen address (MLA), or another instrument’s talk address.
Similarly, if the oscilloscope is addressed to listen, it will remain configured to listen until a universal unlisten command (UNL), or its own talker address (MTA), is received.
GPIB Signals
GPIB Signals The bus system consists of 16 signal lines and eight ground or
GPIB SignalsGPIB Signals
shield lines. The signal lines are divided into three groups:
1. Data Lines: These eight lines, usually called DI01 through to DI08, carry both program and interface messages. Most of the messages use the 7-bit ASCII code, in which case DI08 is unused.
2–2 ISSUED:September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
2. Handshake Lines: These three lines control the transfer of message bytes between devices. The process is called a three-wire interlocked handshake and it guarantees that the message bytes on the data lines are sent and received without transmission error.
3. Interface Management Lines: These five lines manage the flow of information across the interface:
ATN (ATteNtion): The controller drives the ATN line true when it uses the data lines to send interface messages such as talk and listen addresses or a device clear (DCL) message. When ATN is false, the bus is in data mode for the transfer of program messages from talkers to listeners.
IFC (InterFace Clear): The controller sets the IFC line true to initialize the bus.
REN (Remote ENable): The controller uses this line to place devices in remote or local program mode.
SRQ (Service ReQuest): Any device can drive the SRQ line true to asynchronously request service from the controller. This is the equivalent of a single interrupt line on a computer bus.
EOI (End Or Identify): This line has two purposes. The talker uses it to mark the end of a message string. The controller uses it to tell devices to identify their response in a parallel poll (discussed later in this section).
I/O Buffers
I/O Buffers The instrument has 256-byte input and output buffers. An
I/O BuffersI/O Buffers
incoming program message is not decoded before a message terminator has been received. However, if the input buffer becomes full (because the program message is longer than the buffer), the instrument starts analyzing the message. In this case data transmission is temporarily halted, and the controller may generate a timeout if the limit was set too low.
IEEE 488.1 Standard
IEEE 488.1 Standard
IEEE 488.1 StandardIEEE 488.1 Standard Messages
Messages
MessagesMessages
LCXXX-RM-E Rev P ISSUED: September 2001 2–3
The IEEE 488.1 standard specifies not only the mechanical and electrical aspects of the GPIB, but also the low-level transfer protocol — for instance, it defines how a controller addresses devices, turns them into talkers or listeners, resets them or puts
GPIB
GPIB
GPIBGPIB
Note:
Note: In addition to the IEEE 488.1 interface message
Note: Note:
standards, the IEEE 488.2 standard specifies certain standardized program messages, i.e. command headers. They are identified with a leading asterisk <*> and are listed in the System Commands section.
them in the remote state. Such interface messages are executed with the interface management lines of the GPIB, usually with ATN true.
All of these messages (except GET) are executed immediately upon reception and not, with normal commands, in chronological order.
The command list in System Commands does not contain a command for clearing the input or output buffers, nor for setting the instrument to the remote state. This is because such commands are already specified as IEEE 488.1 standard messages. Refer to the GPIB interface manual of the host
controller as well as to its support programs, which should contain special calls for the execution of these messages.
The following description covers those IEEE 488.1 standard messages which go beyond mere reconfiguration of the bus and have an effect on the operation of the instrument.
Device CLear
Device CLear In response to a universal Device CLear (DCL) or a Selected
Device CLearDevice CLear
Device Clear message (SDC), the oscilloscope clears the input or output buffers, aborts the interpretation of the current command (if any) and clears pending commands. However, status registers and status-enable registers are not cleared. Although DCL has an immediate effect it can take several seconds to execute if the instrument is busy.
Group Execute Trigger
Group Execute Trigger The Group Execute Trigger message (GET) causes the
Group Execute TriggerGroup Execute Trigger
oscilloscope to arm the trigger system. It is functionally identical to the “*TRG” command.
Remote ENable
Remote ENable This interface message is executed when the controller holds the
Remote ENableRemote ENable
Remote ENable control line (REN) true and configures the instrument as a listener. All the front-panel controls except the menu buttons are disabled. The menu indications on the right­hand side of the screen no longer appear, since menus cannot
2–4 ISSUED:September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
now be operated manually. Instead, the text REMOTE ENABLE appears at the top of the menu field to indicate that the instrument is set to the remote mode. Whenever the controller returns the REN line to false, all instruments on the bus return to GO TO LOCAL. Individual instruments can be returned to LOCAL with the Go To Local message (see below).
Local front-panel control may be regained by pressing the GO TO LOCAL menu button, unless the instrument has been placed in Local LOckout (LLO) mode.
Local LOckout
Local LOckout The Local LOckout command (LLO) causes the GO TO LOCAL
Local LOckoutLocal LOckout
menu to disappear. The LLO command can be sent in local or remote mode but only becomes effective once the instrument has been set to the remote mode.
Go To Local
Go To Local The Go To Local message (GTL) causes the instrument to return
Go To LocalGo To Local
to local mode. All front-panel controls become active and the normal menus reappear. Thereafter, whenever the instrument is addressed as a listener it will be immediately reset to the remote state — except when the LLO command has been sent.
When Local Lockout is activated the scope can only be returned to its local state by the controller returning the LLO to false. And whenever the instrument returns to the remote state the local lockout mode will immediately become effective again.
InterFace Clear
InterFace Clear The InterFace Clear message (IFC) initializes the GPIB but has
InterFace ClearInterFace Clear
no effect on the operation of the oscilloscope.
Programming GPIB
Programming GPIB
Programming GPIBProgramming GPIB Transfers
Transfers
TransfersTransfers
LCXXX-RM-E Rev P ISSUED: September 2001 2–5
To illustrate the GPIB programming concepts a number of examples written in BASICA are included here. It is assumed that the controller
is IBM-PC compatible, running under DOS, and that it is equipped with a National Instruments GPIB programming with other languages such as C or Pascal is quite similar to this.
If using another type of computer or GPIB interface, refer to the interface manual for installation procedures and subroutine calls.
National Instruments Corporation, 12109 Technology Boulevard, Austin, Texas 78727, USA.
GPIB interface card. Nevertheless,
Configuring the
Configuring the
Configuring theConfi guring t he GPIB Driver Hardware
GPIB Driver Hardware
GPIB Driver HardwareGPIB Driver Hardware
Configuring the
Configuring the
Configuring theConfi guring t he
GPIB Driver Software
GPIB Driver Software
GPIB Driver SoftwareGPIB Driver Software
GPIB
GPIB
GPIBGPIB
Check that the GPIB interface is properly installed in the computer. If found that it is not, follow the interface manufacturer’s installation instructions. In the case of the National Instruments interface, it is possible to modify the base I/O address of the board, the DMA channel number and the interrupt line setting using switches and jumpers.
In these program examples, default positions are assumed. Connect the oscilloscope to the computer with a GPIB interface
cable. Set the GPIB address to the required value. The program examples assume a setting of ‘4’.
The host computer requires an interface driver that handles the transactions between the operator’s programs and the interface board. In the case of the National Instruments interface, the installation procedure copies the GPIB handler GPIB.COM into the boot directory, modifies the DOS system configuration file CONFIG.SYS to declare the presence of the GPIB handler, creates a sub-directory GPIB-PC, and installs in GPIB-PC a number of files and programs useful for testing and reconfiguring the system and for writing user programs.
The following files in the sub-directory GPIB-PC are particularly useful:
IBIC.EXE allows interactive control of the GPIB via functions entered at the keyboard. Use of this program is highly recommended to anyone unfamiliar with GPIB programming or the oscilloscope’s remote commands.
DECL.BAS is a declaration file that contains code to be included at the beginning of any BASICA application program. Simple application programs can be quickly written by appending the operator’s instructions to DECL.BAS and executing the complete file.
IBCONF.EXE is an interactive program that allows inspection or modification of the current settings of the GPIB handler.
To run IBCONF.EXE, refer to the National Instruments manual.
2–6 ISSUED:September 2001 LCXXX-RM-E Rev P
9300 & LC Series
:
:
9300 & LC Series
9300 & LC Series9300 & LC Series
In the program examples in this section, it is assumed that the National Instruments GPIB driver GPIB.COM is in its default state — i.e. that the user has not modified it with IBCONF.EXE. This means that the interface board can be referred to by the symbolic name ‘GPIB0’ and that devices on the GPIB bus with addresses between 1 and 16 can be called by the symbolic names ‘DEV1’ to ‘DEV16’.
Note
Note:
Note:Note
In the program examples in this section, it is assumed that the National Instruments GPIB driver GPIB.COM is in its default state — i.e. that the user has not modified it with IBCONF.EXE. This means that the interface board can be referred to by the symbolic name ‘GPIB0’ and that devices on the GPIB bus with addresses between 1 and 16 can be called by the symbolic names ‘DEV1’ to ‘DEV16’.
If you have a National Instruments PC2 interface card rather than PC2A, you must run IBCONF to declare the presence of this card rather than the default PC2A.
Simple Transfers
Simple Transfers For a large number of remote control operations it is sufficient to
Simple TransfersSimple Transfers
use just three different subroutines (IBFIND, IBRD and IBWRT) provided by National Instruments. The following complete program reads the timebase setting of the oscilloscope and displays it on the terminal:
1–99 <DECL.BAS> 100 DEV$=“DEV4” 110 CALL IBFIND(DEV$,SCOPE%) 120 CMD$=“TDIV?” 130 CALL IBWRT(SCOPE%,CMD$) 140 CALL IBRD(SCOPE%,RD$) 150 PRINT RD$ 160 END
Lines 1–99 are a copy of the file DECL.BAS supplied by National Instruments. The first six lines are required for the initialization of the GPIB handler. The other lines are declarations which may be useful for larger programs, but are not really required code. The
LCXXX-RM-E Rev P ISSUED: September 2001 2–7
GPIB
GPIB
GPIBGPIB
sample program above only uses the strings CMD$ and RD$ which are declared in DECL.BAS as arrays of 255 characters.
Note:
Note:
Note:Note:
DECL.BAS requires access to the file BIB.M during the GPIB initialization. BIB.M is one of the files supplied by National Instruments, and it must exist in the directory currently in use.
The first two lines of DECL.BAS both contain a string “XXXXX” which must be replaced by the number of bytes which determine the maximum workspace for BASICA (computed by subtracting t he size of BIB.M from the space currently available in BASICA). For example, if the size of BIB.M is 1200 bytes and when BASICA is loaded it reports “60200 bytes free”, you should replace “XXXXX” by the value 59 000 or less.
Lines 100 and 110 open the device “DEV4” and associate with it the descriptor “SCOPE%”. All I/O calls after that will refer to “SCOPE%”. The default configuration of the GPIB handler recognizes “DEV4” and associates with it a device with GPIB address 4.
Lines 120 and 130 prepare the command string TDIV? and transfer it to the instrument. The command instructs the instrument to respond with the current setting of the timebase.
Lines 140 and 150 reads the response of the instrument and places it into the character string RD$.
Line 170 displays the response on the terminal. When running this sample program, the oscilloscope will
automatically be set to the remote state when IBWRT is executed, and will remain in that state. Pressing the LOCAL menu button will return the oscilloscope to local mode if the GPIB handler was modified to inhibit Local LOckout (LLO).
Here is a slightly modified version of the sample program which checks if any error occurred during GPIB operation:
2–8 ISSUED:September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
1–99 <DECL.BAS> 100 DEV$=“DEV4” 110 CALL IBFIND(DEV$,SCOPE%) 120 CMD$=“TDIV?” 130 CALL IBWRT(SCOPE%,CMD$) 140 IF ISTA% < 0 THEN GOTO 200 150 CALL IBRD(SCOPE%,RD$) 160 IF ISTA% < 0 THEN GOTO 250 170 PRINT RD$ 180 IBLOC(SCOPE%) 190 END 200 PRINT “WRITE ERROR =”;IBERR% 210 END 250 PRINT “READ ERROR =”;IBERR% 260 END
The GPIB status word ISTA%, the GPIB error variable IBERR% and the count variable IBCNT% are defined by the GPIB handler and are updated with every GPIB function call. Refer to the National Instruments manual for details. The sample program above would report if the GPIB address of the instrument was set to a value other then 4. Line 180 resets the instrument to local with a call to the GPIB routine IBLOC.
Additional Driv er C al ls
Additional Driv er C al ls IBLOC is used to execute the IEEE 488.1 standard message Go
Additional Driv er C al lsAdditional Driv er C al ls
To Local (GTL), i.e. it returns the instrument to the local state. The programming example above illustrates its use.
IBCLR executes the IEEE 488.1 standard message Selected Device Clear (SDC).
IBRDF and IBWRTF, respectively, allow data to be read from GPIB to a file, and written from a file to GPIB. Transferring data directly to or from a storage device does not limit the size of the data block, but may be slower than transferring to the computer memory.
IBRDI and IBWRTI, respectively, allow data to be read from GPIB to an integer array, and written from integer array to GPIB. Since the integer array allows storage of up to 64 kilobytes (in BASIC), IBRDI and IBWRTI should be used for the transfer of large data blocks to the computer memory, rather than IBRD or
LCXXX-RM-E Rev P ISSUED: September 2001 2–9
GPIB
GPIB
GPIBGPIB
IBWRT, which are limited to 256 bytes by the BASIC string length. Note that IBRDI and IBWRTI only exist for BASIC, since for more modern programming languages, such as C, the function calls IBRD and IBWRT are far less limited in terms of data-block size.
IBTMO can be used to change the timeout value during program execution. The default value of the GPIB driver is 10 seconds — for example, if the instrument does not respond to an IBRD call, IBRD will return with an error after the specified time.
IBTRG executes the IEEE 488.1 standard message Group Execute Trigger (GET), which causes the oscilloscope to arm the trigger system.
National Instruments supply a number of additional function calls. In particular, it is possible to use the so-called board level calls which allow a very detailed control of the GPIB.
Service Requests
Service Requests When an oscilloscope is used in a remote application, events
Service RequestsService Requests
often occur asynchronously — at times that are unpredictable for the host computer. The most common example of this is the wait of a trigger after the arming of the instrument: the controller must wait until the acquisition is finished before it can read the acquired waveform. The simplest way of checking if a certain event has occurred is by either continuously or periodically reading the status bit associated with it until the required transition is detected. Continuous status bit polling is described in
more detail below. For a complete explanation of status bytes refer to Chapter 5.
A potentially more efficient way of detecting events occurring in the instrument is the use of the Service Request (SRQ). This GPIB interrupt line can be used to interrupt program execution in the controller. The controller can then execute other programs while waiting for the instrument. Unfortunately, not all interface manufacturers support the programming of interrupt service routines. In particular, National Instruments supports only the SRQ bit within the ISTA% status word. This requires the user to continuously or periodically check this word, either explicitly or with the function call IBWAIT. In the absence of real interrupt service routines the use of SRQ may not be very advantageous.
2–10 ISSUED: September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
In the default state, after power-on, the Service ReQuest is disabled. The SRQ is enabled by setting the Service Request Enable register with the command “*SRE” and specifying which event should generate an SRQ. The oscilloscope will interrupt the controller as soon as the selected event(s) occur by asserting the SRQ interface line. If several devices are connected to the GPIB, the controller may be required to identify which instrument caused the interrupt by serial polling the various devices.
Note:
Note: The SRQ bit is latched until the controller reads the
Note:Note:
STatus Byte Register (STB). The action of reading the STB with the command “*STB?” clears the register contents except the MAV bit (bit 4) until a new event occurs. Service requesting may be disabled by clearing the SRE register (“*SRE 0”).
Example 1
Example 1 To assert SRQ in response to the events “new signal
Example 1Example 1
acquired” or “return-to-local” (pressing the soft key/menu button for GO TO LOCAL).
These events are tracked by the INR register which is reflected in the SRE register as the INB summary bit in position 0. Since the bit position 0 has the value 1, the command “*SRE 1” enables the generation of SRQ whenever the INB summary bit is set.
In addition, the events of the INR register that may be
Note on Terms:
Note on Terms: The term “soft-key”, used here in
Note on Terms:Note on Terms:
reference to remote operations, is synonymous with “menu button”, used exclusively in the accompanying Operator’s Manual for front-panel operations. Both terms refer to the column of seven buttons running parallel to the screen on the oscilloscope front panel and the functions they control.
summarized in the INB bit must be specified. The event “new signal acquired” corresponds to INE bit 0 (value 1) while the event “return-to-local” is assigned to INE bit 2 (value 4). The total sum is 1 + 4 = 5. Thus the command “INE 5” is needed:
CMD$=“INE 5;*SRE 1”
LCXXX-RM-E Rev P ISSUED: September 2001 2–11
GPIB
GPIB
GPIBGPIB
CALL IBWRT(SCOPE%,CMD$)
Example 2
Example 2 To assert SRQ when soft key 4 (fourth menu button from top
Example 2Example 2
of screen) is pressed.
The event “soft key 4 pressed” is tracked by the URR register. Since the URR register is not directly reflected in STB but only in the ESR register (URR, bit position 6), the ESE enable register must be set first with the command “*ESE 64” to allow the URQ setting to be reported in STB. An SRQ request will now be generated provided that the ESB summary bit (bit position 5) in the SRE enable register is set (“*SRE 32”):
CMD$=“*ESE 64;*SRE 32” CALL IBWRT(SCOPE%,CMD$)
2–12 ISSUED: September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
Instrument Polls
Instrument Polls
Instrument PollsInstrument Polls
State transitions occurring within the instrument can be remotely monitored by polling selected internal status registers (see, too, Chapter 5). Four basic polling methods can be used to detect the occurrence of a given event. These are continuous, serial, parallel and *IST.
By far the simplest of these is continuous polling. The other three are appropriate only when interrupt service routines (servicing the SRQ line) are supported, or multiple devices on GPIB require constant monitoring. Emphasizing the differences between these methods, which are described below, the same example — determining whether a new acquisition has taken place — is presented in respect of each.
Continuous Poll
Continuous Poll Here, a status register is continuously monitored until a transition
Continuous PollContinuous Poll
is observed. This is the most straightforward method for detecting state changes, but may be impracticable in certain situations, especially with multiple device configurations.
In the following example, the event “new signal acquired” is observed by continuously polling the INternal state change Register (INR) until the corresponding bit (in this case bit 0, i.e. value 1) is non-zero, indicating a new waveform has been acquired. Reading INR clears this at the same time, obviating the need for an additional clearing action after a non-zero value has been detected. The command “CHDR OFF” instructs the instrument to omit any command headers when responding to a query, simplifying the decoding of the response. The instrument will then send “1” instead of “INR 1”:
CMD$=“CHDR OFF” CALL IBWRT(SCOPE%,CMD$) MASK% = 1 ‘New Signal Bit has value 1’ LOOP% = 1 WHILE LOOP%
CMD$=“INR?” CALL IBWRT(SCOPE%,CMD$) CALL IBRD(SCOPE%,RD$) NEWSIG% = VAL(RD$) AND MASK%
LCXXX-RM-E Rev P ISSUED: September 2001 2–13
GPIB
GPIB
GPIBGPIB
IF NEWSIG% = MASK% THEN LOOP% = 0
WEND
Serial Poll
Serial Poll Serial polling takes place once the SRQ interrupt line has been
Serial PollSerial Poll
asserted, and is only advantageous when there are several instruments involved. The controller finds which device of a number has generated the interrupt by inspecting the SRQ bit in the STB register of each instrument. Because the service request is based on an interrupt mechanism, serial polling offers a reasonable compromise in terms of servicing speed in multiple­device configurations.
In the following example, the command “INE 1” enables the event “new signal acquired” to be reported in the INR to the INB bit of the status byte STB. The command “*SRE 1” enables the INB of the status byte to generate an SRQ whenever it is set. The function call IBWAIT instructs the computer to wait until one of three conditions occurs: &H8000 in the mask (MASK%) corresponds to a GPIB error, &H4000 to a timeout error, and &H0800 to the detection of RQS (ReQuest for Service) generated by the SRQ bit.
Whenever IBWAIT detects RQS it automatically performs a serial poll to find out which instrument generated the interrupt. It will only exit if there was a timeout or if the instrument “SCOPE%” generated SRQ. The additional function call IBRSP fetches the value of the status byte which may be further interpreted. For this to function properly the value of “Disable Auto Serial Polling” must be set to “off” in the GPIB handler (use IBCONF.EXE to check):
CMD$=“*CLS; INE 1; *SRE 1” CALL IBWRT(SCOPE%,CMD$) MASK% = &HC800 CALL IBWAIT(SCOPE%,MASK%) IF (IBSTA% AND &HC000) <> 0 THEN PRINT “GPIB or Timeout Error” : STOP CALL IBRSP(SCOPE%,SPR%) PRINT “Status Byte =.”, SPR%
Board-level function calls can deal simultaneously with several instruments attached to the same interface board. Refer to the National Instruments manual.
2–14 ISSUED: September 2001 LCXXX-RM-E Rev P
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
Note:
Note: After the serial poll is completed, the RQS bit in the
Note:Note:
STB status register is cleared. Note that the other STB register bits remain set until they are cleared by means of a “*CLS” command or the instrument is reset. If these bits are not cleared, they cannot generate another interrupt.
Parallel Poll
Parallel Poll Like serial polling, this is only advantageous when there are several
Parallel PollParallel Poll
instruments. In parallel polling, the controller simultaneously reads the Individual STatus bit (IST) of all the instruments to determine which needs service. Because this method allows up to eight different instruments to be polled at the same time, it is the fastest way to identify state changes in instruments with this capability.
When a parallel poll is initiated, each instrument returns a status bit over one of the DIO data lines. Devices may respond either individually, using a separate DIO line, or collectively on a single data line. Data-line assignments are made by the controller using a Parallel Poll Configure (PPC) sequence.
In the following example, the command “INE 1” enables the event “new signal acquired” in the INR to be reported to the INB bit of the status byte STB. The PaRallel poll Enable register (PRE) determines which events will be summarized in the IST status bit. The command “*PRE 1” enables the INB bit to set the IST bit whenever it is itself set. Once parallel polling has been established, the parallel-poll status is examined until a change on data bus line DI02 takes place.
Stage 1: Enable the INE and PRE registers, configure the controller for parallel poll and instruct the oscilloscope to respond on data line 2 (DI02)
CMD1$=“?_@$” CALL IBCMD(BRD0%,CMD1$) CMD$=“INE 1;*PRE 1” CALL IBWRT(BRD0%,CMD$) CMD4$=CHR$(&H5)+CHR$(&H69)+“?” CALL IBCMD(BRD0%,CMD4$)
LCXXX-RM-E Rev P ISSUED: September 2001 2–15
GPIB
:
:
GPIB
GPIBGPIB
Stage 2: Parallel poll the instrument until DI02 is set
LOOP% = 1 WHILE LOOP% CALL IBRPP(BRD0%,PPR%) IF (PPR% AND &H2) = 2 THEN LOOP% = 0 WEND
Stage 3: Disable parallel polling (hex 15) and clear the parallel poll register
CMD5$=CHR$(&H15) CALL IBCMD(BRD0%,CMD5$) CALL IBCMD(BRD0%,CMD1$) CMD$=“*PRE 0” CALL IBWRT(BRD0%,CMD$):
Note
Note: In the example above, board-level GPIB function
Note:Note
calls are used. It is assumed that the controller (board) and scope (device) are respectively located at addresses 0 and
4. The listener and talker addresses for the controller and oscilloscope are
Logic Device
Logic Device Listener Address
Logic DeviceLogic Device
ExternalController 32 ASCII<space>) 64 (ASCII @)
Oscilloscope 32+4=36 (ASCII $) 64+4=68 (ASCII D)
2–16 ISSUED: September 2001 LCXXX-RM-E Rev P
Listener Address Talker Address
Listener AddressListener Address
Talker Address
Talker AddressTalker Address
9300 & LC Series
9300 & LC Series
9300 & LC Series9300 & LC Series
*IST Poll
*IST Poll The state of the Individual STatus bit (IST) returned in parallel
*IST Poll*IST Poll
polling can also be read by sending the “*IST?” query. To enable this poll mode, the oscilloscope must be initialized as for parallel polling by writing into the PRE register. Since *IST polling emulates parallel polling, this method is applicable in all instances where parallel polling is not supported by the controller.
Note:
Note:
Note:Note:
The characters “?” and “_” appearing in the command strings stand for unlisten and untalk respectively. They are used to set the devices to a “known” state.
To shorten the size of the program examples, device talking and listening initialization instructions have been grouped into character chains. They are:
CMD1$ = “?_@$” Unlisten, Untalk, PC talker, DSO listener
The remote message code for executing a parallel response in binary form is 01101PPP, where PPP specifies the data line. Since data line 2 is selected, the identification code is 001, which results in the code 01101001 (binary) or &H69 (hex). See Table 38 of the IEEE 488-1978 Standard for further details.
In the following example, the command “INE 1” enables the event “new signal acquired” in the INR to be reported to the INB bit of the status byte STB. The command “*PRE 1” enables the INB bit to set the IST bit whenever it is set. The command “CHDR OFF” suppresses the command header in the instrument’s response, simplifying the interpretation. The status of the IST bit is then continuously monitored until set by the instrument:
LCXXX-RM-E Rev P ISSUED: September 2001 2–17
Loading...
+ 270 hidden pages