LeCroy, ActiveDSO, ProBus, SMART Trigger, JitterTrack, WavePro, WaveMaster, WaveSurfer,
and Waverunner are registered trademarks of LeCroy Corporation. Information in this publication
supersedes all earlier versions. Specifications subject to change without notice.
ISO 9001:2000
FM 65813
Manufactured under an ISO 9000 Registered Quality Management System
Decoding Floating Point Numbers....................................................................................291
How to Construct a Floating Point Number from Four Bytes........................................296
WM-RCM-E Rev D ISSUED: February 2005
v
BLANK PAGE
vi
ISSUED: February 2005
WM-RCM-E Rev D
I
NTRO DUCTION
About this Manual
This manual explains how to control the instrument from a computer, using commands keyed or
programmed into an external controller. This controller is usually a computer, but it could be a
simple terminal.
The manual includes a complete list of the commands that you will need to perform remote
control operations with the instrument. The manual has two main parts:
Part One, “About Remote Control,” covers the principles of remote control and offers
practical examples.
Part Two, “Commands,” describes e ach of the remote control commands a nd queries for
instrument operations. It starts with two special indexes that list the commands by short name
and by category. Use these to find the command or query you want to use.
As an additional guide, each chapter is prefaced by a summary of its contents.
Watch for these icons and the information they signal:
offer additional hints on how to get the most out of instrument action s or
TTIIPPss
features.
NNOOTTEEss
Important Note for users of other LeCroy DSOs
Existing software: Although the X-Stream™ family of instruments makes
extensive use of Automation interfacing, enabling many powerful means of
control, most of the commonly used remote control commands have been
retained, though in some cases there are minor changes in definitions.
Automation commands can be used in existing software by using the VBS
command, which is explained in Chapter 6.
Trace labels: Math traces TA, TB, TC, and TD have been replaced by F1, F2, F3
and F4, respectively. Existing software that includes the old trace labels will work
with the X-Stream scopes, but new software should use the new labels unless it
will be used on earlier DSOs. In addition to these four traces, the instruments
include traces math functions F5, F6, F7, and F8. All eight traces are equivalent in
their ability to perform zooms or math processing. Memory trace labels M1, M2,
M3, and M4 are also permissible trace labels.
Parameter labels have also changed. These are now P1 . . . P8, but the older
labels Cust1 . . . Cust5 will still work.
bring to your attention important information you should know. Example -
§ § §
WM-RCM-E Rev D ISSUED: February 2005
1
BLANK PAGE
2
ISSUED: February 2005
WM-RCM-E Rev D
O
P
AARRTT
P
A
R
Part One explains how the instrument operates under remote control. It covers GPIB and
LAN interfaces, the transfer and formatting of waveforms, and the use of status bytes in
reporting errors.
R
E
E
M
M
O
O
T
T
A
B
B
E
E
O
O
C
C
O
U
U
O
O
E
NNE
T
T
N
N
T
T
R
R
O
O
L
L
WM-RCM-E Rev D ISSUED: February 2005
3
C
HAPTER ONE:
In this chapter, see how to
¾ Construct program messages
¾ Use commands and queries
¾ Include data, and make data strings
Overview
4
ISSUED: February 2005
WM-RCM-E Rev D
C
HAPTER
O
NE
Overview
Operate Your Instrument by Remote Control
You can fully control your instrument remotely by using either the optional GPIB (General Purpose Interface
Bus) port, if available, or the LAN communication port on the scope's I/O panel, shown below (8). The only
actions for which you must use the front panel controls are to power up the scope and to set remote control
addresses.
Typical I/O panel, including the LAN port (8) used for remote control
: Use the instrument's Remote Control Assistant to monitor all your remote control
TTIIPP:
operations. See the COMM_HELP command in Part Two of this manual.”
STANDARDS
LeCroy’s remote control commands conform to the GPIB IEEE 488.2
extension of the IEEE 488.1 standard, which deals mainly with electrical and mechanical issues.
*
standard. This may be considered an
COMPATIBILITY WITH OTHER LECROY SCOPES
Throughout LeCroy's history, the company has striven to maximize compatibility. This policy continues to
operate. But the X-Stream DSOs introduce a completely new philosophy in scope communication, enabling the
scopes to control powerful proprietary programs within the instrument and within the processing chain. You
may find that a few “GPIB” commands, used for the earlier scopes, do not work on X-Stream scopes. The
solution is to use the new Automation commands, which are described in Chapter 6. It is easy to integrate these
commands into a GPIB program, using the command VBS. But you should find that for the most frequently
used commands and queries, existing scopes and X-Stream scopes are compatible, apart from a few details.
*
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
WM-RCM-E Rev D ISSUED: February 2005
5
P
ART ONE:
PROGRAM MESSAGES
You control the oscilloscope remotely using program messages that consist of one or more commands or
queries. The program messages you send from the external controller to the X-Stream oscilloscope must
conform to precise format structures. The oscilloscope will execute all program messages sent in the correct
form, but will ignore those with errors.
You can use uppercase or lowercase characters, or both, in program messages; the scope does not distinguish
between them. But the MESSAGE command can faithfully transmit strings containing both lowercase and
uppercase letters.
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. If you connect an external monitor to the instrument’s LAN port, however, you will be able to observe
all your remote control transactions, including error messages, as they happen. See the command
COMM_HELP in Part Two, “Commands.”
Program messages are separated by semicolons ; and end in a terminator:
The oscilloscope will not decode an incoming program message before receiving its terminator. The exception is
when the program message is longer than the 256 byte input buffer; then 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:
ABOUT REMOTE CONTROL
<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
The <NL> <EOI> terminator is always used in response messages sent by the oscilloscope to the controller.
: The <EOI> signal is a dedicated GPIB interface line, which can
NNOOTTEE:
be set with a special call to the GPIB interface driver. Refer to the GPIB
interface manufacturer’s manual and support programs.
COMMANDS AND QUERIES
Program messages are made up of one or more commands or queries. While the command directs the
oscilloscope to change its state (for example, its timebase or vertical sensitivity) the query asks the oscilloscope
about that state. Very often, you will use the same characters 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, send this command to the oscilloscope:
TIME_DIV 2 M
Or, to ask the oscilloscope about its timebase, send this query: TIME_DIV?
6
ISSUED: February 2005
WM-RCM-E Rev D
C
HAPTER ONE
:
Overview
A query causes the oscilloscope to send a response message. The control program should read this message with
a ‘read’ instruction to the GPIB or LAN interface of the controller.
The response message to the above query might be: TIME_DIV 10 NS
The portion of the query preceding the question mark is repeated as part of the response message. If desired,
this text can be suppressed with the command: COMM_HEADER.
Depending on the state of the oscilloscope and the computation to be done, several seconds may pass before a
response is received. Command interpretation does not have priority over other oscilloscope activities.
The general form of a command or a query consists of a 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).
There is a space between the header and the first parameter.
Use commas between parameters.
The terminator is not shown because usually it is automatically added by the interface driver routine writing to
GPIB.
: The response to a query can be a useful
TTIIPP:
way of generating a command that is known to
be correct, and the response can be copied
straight into your program.
Following are examples of how program messages are made up of commands and queries.
GRID DUAL This program message consists of a single command that instructs the oscilloscope to display a
dual grid.
BUZZ BEEP; DISPLAY OFF; DATE? This program message consists of two commands, followed by a
query. They instruct the oscilloscope to beep once, turn off the display, and then ask for the current date. Again,
the terminator is not shown.
DATE 15,JAN,1993,13,21,16 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.
WM-RCM-E Rev D ISSUED: February 2005
: Set the controller I/O timeout conditions
TTIIPP:
to three or more seconds to give the scope time
to respond. An incorrect query will not get a
response; and, if Remote Control Assistant is
enabled, a beep will sound.
7
P
ART ONE:
HEADERS
The header is the mnemonic form of the operation to be performed by the oscilloscope. Most command and
query headers have a long form, which allows them to be read more easily by people, and a short form for better
transfer and decoding speed. The two are fully equivalent and you can use them interchangeably. For example,
TRIG_MODE AUTO and TRMD AUTO are two separate but equivalent commands for switching to the
automatic trigger mode.
Some command or query mnemonics are imposed by the IEEE 488.2 standard. They are standardized so that
different oscilloscopes will 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 oscilloscope, whereas *TST? instructs the oscilloscope to perform an internal self-test and report the
outcome.
HEADER PATHS
Certain commands or queries apply to a subsection of the oscilloscope; for example, a single input channel or a
trace on the display. In such cases, you must prefix the header 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:
C1, C2 Channels 1 and 2
ABOUT REMOTE CONTROL
Header Path Name Waveform Trace
C3, C4 Channels 3 and 4 (on four-channel models)
M1, M2, M3, M4 Memories 1, 2, and 3 and 4
F1, 2, F3, F4, F5, F6, F7, F8
TA, TB, TC, TD
EX, EX10, EX5 External trigger
LINE LINE source for trigger
Example: C1:OFST -300 MV Command to set the offset of Channel 1 to -300 mV.
You need only specify a header path once. Subsequent commands with header destinations not indicated are
assumed to refer to the last defined path. For example, the queries C2:VDIV?; C2:OFST? ask: What is the vertical
sensitivity and the offset of channel 2? While the queries C2:VDIV?; OFST? ask exactly the same questions
without repeating the path.
8
ISSUED: February 2005
Traces F1 through F8
Equivalent to F1 through F4, for backward
compatibility with other LeCroy DSOs.
WM-RCM-E Rev D
C
HAPTER ONE
:
Overview
NNOOTTEE:
response from the scope uses the new label; for example, it substitutes
F3 for TC.
DATA
Whenever a command or query uses additional data values, the values are expressed as ASCII characters. There
is a single exception: the transfer of waveforms with the command/query WAVEFORM, where the waveform
can be expressed as a sequence of binary data values. See Chapter 4, “Wav eform St r u c t ure.” ASCII data can
have the form of character, numeric, string, or block data.
CHARACTER DATA
These are simple words or abbreviations to indicate a specific action.
Example: F3:TRA ON
In this example, the data value ON commands the trace F3 to be turned on (the data value OFF will have the
opposite effect).
However, this can become more complex. In some commands, where you can specify as many as a dozen
different parameters, 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 that are to be changed need to be indicated.
Example: HARDCOPY_SETUP DEV,EPSON,PORT,GPIB
In this example, two pairs of parameters have been used. The first specifies the device as an EPSON (or
compatible) printer, while the second indicates the GPIB port. While the command HARDCOPY_SETUP
allows many more parameters, either they are not relevant for printers or they are left unchanged.
: If you use one of the older trace labels, for example "TC", any
NUMERIC DATA
The numeric data type is used to enter quantitative information. Numbers can be entered as integers or
fractions, or in exponential representation:
F1:VPOS -5Move the display of Trace A downward by five divisions.
C2:OFST 3.56Set the DC offset of Channel 2 to 3.56 V.
TDIV 5.0E-6Adjust the timebase to 5 µsec/div.
Example: There are many ways of setting the timebase of the oscilloscope to 5 µsec/div:
TDIV 5E-6Exponential notation, without any suffix.
TDIV 5 US
WM-RCM-E Rev D ISSUED: February 2005
Suffix multiplier U for 1E−6, with the (optional) suffix S for
seconds, or TDIV 5000 NS or TDIV 5000E-3 US
9
P
ART ONE:
You can follow numeric values with multipliers and units to modify the value of the numerical expression. The
following mnemonics are recognized:
This data type enables you to transfer a (long) string of characters as a single parameter. Simply enclose any
sequence of ASCII characters between single or double quotation marks:
MESSAGE ‘Connect probe to point J3’
The oscilloscope displays this message in the message line at the bottom of the screen.
BLOCK DATA
These are binary data values coded in hexadecimal ASCII: four-bit nibbles translated into the digits 0 through 9
or A through F, and transmitted as ASCII characters. They are used only for the transfer of waveforms from the
oscilloscope to the controller (WAVEFORM) and for instrument panel setups (PANEL_SETUP).
RESPONSE MESSAGES
The oscilloscope sends a response message to the controller in answer to a query. The format of such messages
is the same as that of program messages: individual responses in the format of commands, separated by
semicolons ; and ending in terminators. These messages can be sent back to the oscilloscope in the form in
which they were received, to be accepted as valid commands. In GPIB response messages, the <NL> <EOI>
terminator is always used.
Example: The controller sends the program message:
TIME_DIV?;TRIG_MODE NORM;C1:COUPLING? (terminator not shown).
1E−3
1E−9
1E−15
milli- U
nano- P
femto- A
1E−6
1E−12
1E−18
micro-
pico-
atto-
The oscilloscope might respond to this with:
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
oscilloscope, it is a valid program message for setting its timebase to 50 ns/div and the input coupling of
Channel 1 to 50 Ω.
10
ISSUED: February 2005
WM-RCM-E Rev D
C
HAPTER ONE
Whenever you expect a response from the oscilloscope, you must have the control program instruct the GPIB
or LAN interface to read from the oscilloscope. If the controller sends another program message without
reading the response to the previous one, the response message in the output buffer of the oscilloscope will be
discarded. The oscilloscope keeps to stricter rules for response messages than for acceptance of program
messages. While you can send program messages from the controller in uppercase or lowercase characters,
response messages are always returned in uppercase. Program messages may contain extraneous spaces or tabs
(white space), but response messages will not. And while program messages may contain a mixture of short and
long command or query headers, response messages always use short headers by default.
However, you can use the command COMM_HEADER to force the oscilloscope to use long headers, or none
at all. If the response header is omitted, the response transfer time will be minimized. But the response will not
be able to be sent back to the oscilloscope. Suffix units are also suppressed in the response. An advantage of
headerless operation is the ease with which programs can use the data, because they do not have to find and
remove the headers. But C1:PAVA? ALL will return a string like this - AMPL,292.3E-3,OK,DLY,-2.333E6,OK,FALL,95.121E-9,OK,MEAN,66E-6,OK,PER,332.8E-9,OK,PKPK,308E-3,OK,RISE,92.346E9,OK,RMS,106.1E-3,OK,SDEV,106.1E-3,OK,WID,166.3E-9,OK, even with CHDR OFF, because only the
header is removed. All other alphabetic information is always transmitted.
If you were to set the trigger slope of Channel 1 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
:
Overview
§ § §
WM-RCM-E Rev D ISSUED: February 2005
: Waveforms you obtain from the
TTIIPP:
oscilloscope using the query WAVEFORM?
are a special kind of response message.
Control their exact format by using the
COMM_FORMAT and COMM_ORDER
commands.
11
C
HAPTER TWO:
In this chapter, see how to
¾ Address your X-Stream scope for GPIB
¾ Configure GPIB software
¾ Enable remote and local control
¾ Make transfers of data
¾ Make service requests
¾ Poll your X-Stream scope
¾ Set timing and synchronization
Control by GPIB
12
ISSUED: February 2005
WM-RCM-E Rev D
C
HAPTER
T
WO
Control by GPIB
Talk, Listen, or Control
You can control your X-Stream DSO remotely, using the General Purpose Interface Bus (GPIB). GPIB is
similar to a standard computer bus. But while the computer interconnects circuit cards by means of a
backplane bus, the GPIB interconnects independent devices (oscilloscopes and computers, for example) 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, oscilloscope status and waveform data.
Interface messages manage the bus itself. They perform functions such as initialization, addressing and
“unaddressing” of devices, and the setting of remote and local modes.
On the one hand, devices connected by GPIB to your X-Stream DSO can be listeners, talkers, or controllers. A
talker sends program messages to one or more listeners, while a controller manages the flow of information on
the bus by sending interface messages to the devices. The host computer must be able to play all three roles.
For details of how the controller configures the GPIB for specific functions, refer to the GPIB interface
manufacturer’s manual.
On the other hand, the X-Stream DSO can be a talker or listener, but
Much of the material in this chapter is general to all GPIB systems, but where detailed instructions and
program fragments are provided in this manual, they are based on National Instruments hardware and
software, and on some form of BASIC language. Where INCLUDES are mentioned, this points to the need to
couple the programming language to the GPIB by including some drivers. The National Instruments manuals
explain this. Variables ending with % are integers, and variables ending with $ are strings, in accordance with
the practice in some BASIC languages. The entire system is of course compatible with any hardware and
software based on IEEE-488.2, and any programming language can be used if it can be linked to GPIB.
NOT
a controller.
WM-RCM-E Rev D ISSUED: February 2005
13
P
ART ONE:
INTERFACE
X-Stream DSO interface capabilities include the following IEEE 488.1 definitions:
AH1 Complete Acceptor Handshake DC1 Complete Device Clear Function
L4 Partial Listener Function PP1 Parallel Polling: remote configurable
T5 Complete Talker Function C0 No Controller Functions
SR1 Complete Service Request Function E2 Tri-state Drivers
RL1 Complete Remote/Local Function
ADDRESS
Every device on the GPIB has an address. To address the X-Stream DSO, set the remote control port to GPIB
by means of the scope’s front panel UTILITIES button and on-screen menus.
If you address the X-Stream DSO to talk, it will remain in that state until it receives a universal untalk
command (UNT), its own listen address (MLA), or another oscilloscope’s talk address.
ABOUT REMOTE CONTROL
If you address the X-Stream DSO to listen, it will remain configured to listen until a universal unlisten
command (UNL), or its own talker address (MTA), is received.
To avoid conflicts, use the general Unlisten and Untalk commands before setting up the talker and listener
states.
The following characters are used in GPIB to control talking and listening:
ASCII 63 = ? General Unlisten
ASCII 95 = _ General Untalk
ASCII 32 = Space Base Listen Address
ASCII 64 = @ Base Talk Address
14
ISSUED: February 2005
WM-RCM-E Rev D
C
HAPTER TWO
To make an actual talk address and listen address, we have to add the GPIB address to the ASCII values of the
base characters, to give the ASCII value of the new character. So a string of these commands looks like a
random set of characters. Using named variables makes programs easier to understand. For example, if we
have a DSO at GPIB address 4, and a PC at address 4, we construct the command strings as follows, for use
later in the program.
These last two strings, once defined, can be used in programs for sending to the DSO.
GPIB SIGNALS
The GPIB system consists of 16 signal lines and eight ground or shield lines. The signal lines are divided into
three groups:
:
Control by GPIB
Data Lines: These eight lines, usually called DIO1 through DIO8, carry both program and interface messages.
Most of the messages use the 7-bit ASCII code, in which case DIO8 is unused.
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.
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.
WM-RCM-E Rev D ISSUED: February 2005
15
P
ART ONE:
•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
The oscilloscope has 256-byte input and output buffers. An 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 oscilloscope 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.
USE IEEE 488.1 STANDARD MESSAGES
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 them in the remote state. Such interface messages are executed with the
interface management lines of the GPIB, usually with ATN true.
All these messages except GET are executed immediately upon receipt.
The command list in Part Two of this manual does not contain a command for clearing the input or output
buffers or for setting the oscilloscope to the remote state.
ABOUT REMOTE CONTROL
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 that go beyond mere reconfiguration of
the bus and that have an effect on X-Stream DSO operation.
16
ISSUED: February 2005
NOTE: In addition to the IEEE 488.1 interface
message 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.
WM-RCM-E Rev D
C
HAPTER TWO
DEVICE CLEAR
In response to a universal Device CLear (DCL) or a Selected Device Clear message (SDC), the X-Stream DSO
clears the input or output buffers, cancels the interpretation of the current command (if any) and clears
pending commands. However, status registers and status-enable registers are not cleared. Although DCL will
have an immediate effect, it can take several seconds to execute if the oscilloscope is busy.
GROUP EXECUTE TRIGGER
The Group Execute Trigger message (GET) causes the X-Stream DSO to arm the trigger system, and is
functionally identical to the *TRG command.
REMOTE ENABLE
X-Stream DSOs do not lock out any local controls when placed in the remote state, or in RWLS. It always
accepts remote as well as local control inputs (unless you turn off remote control capability in UtilitiesÆ
Remote.)
INTERFACE CLEAR
The InterFace Clear message (IFC) initializes the GPIB but has no effect on the operation of the
X-Stream DSO.
:
Control by GPIB
NNOOTTEE:
: To illustrate the GPIB programming concepts, a number of examples are included here,
written in a similar way to BASIC. It is assumed that the controller is IBM-PC compatible, and that it
is equipped with a National Instruments GPIB interface card. Nevertheless, GPIB programming with
other languages such as C or Pascal is quite similar. If you’re using another type of computer or
GPIB interface, refer to the interface manual for installation procedures and subroutine calls.
This procedure refers to the installation and configuration of a GPIB card under the DOS operating
system. More recent operating systems (Windows 95, 98, ME, NT, 2000, XP, etc) generally use ‘Plug
‘n’ Play’ GPIB drivers, which are configured using an icon in the control panel.
CONFIGURE THE GPIB DRIVER SOFTWARE
Verify that the GPIB interface is properly installed in the computer. If 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 the program examples below, default positions are assumed.
Connect the X-Stream DSO to the computer with a GPIB interface cable.
Set the GPIB address to the required value. The program examples assume a setting of 4.
WM-RCM-E Rev D ISSUED: February 2005
17
P
ART ONE:
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 will:
• Copy the GPIB handler GPIB.COM into the boot directory.
• Modify the DOS system configuration file CONFIG.SYS to declare the presence of the GPIB handler.
• Create a sub-directory called GPIB-PC, and install 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 by means of functions entered at the keyboard. Use of this
program is highly recommended to anyone unfamiliar with GPIB programming or with the X-Stream DSO’s
remote commands.
IBCONF.EXE is an interactive program that allows inspection or modification of the current settings of the
GPIB handler. To run IBCONF.EXE or a later program version, refer to the National Instruments manual.
: In the program examples in this section, it is assumed that the National Instruments (NI)
NNOOTTEE:
GPIB driver GPIB.COM is in its default state, i.e., that you have 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. Later boards from
National Instruments, and boards from other vendors, will require their own software, though NI has
achieved good compatibility with its earlier systems, and older software will often work with newer
boards.
ABOUT REMOTE CONTROL
18
ISSUED: February 2005
WM-RCM-E Rev D
C
HAPTER TWO
MAKE SIMPLE TRANSFERS
For a large number of remote control operations, it is sufficient to use just three different subroutines
(IBFIND, IBRD and IBWRT) provided by National Instruments. The following complete program reads the
timebase setting of the X-Stream DSO and displays it on the terminal:
:
Control by GPIB
GPIB:
Find: DEV$ = “DEV4” ‘ Because the DSO has been set at
CALL IBFIND (DEV$, SCOPE%) ‘ Find the DSO: label it “SCOPE%”.
Send: CMD$ = “TDIV?” ‘ Make a query string about the
CALL IBWRT (SCOPE%, CMD$) ‘ Send the string to the DSO.
Read: CALL IBRD (SCOPE%, RD$) ‘ Read the response from the DSO.
PRINT RD$ ‘ Print the response string.
END
Explanation
GPIB: This line or lines must hold the link between the programming language and the National Instruments
GPIB functions and drivers.
Find: 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 the GPIB address 4.
Send: Prepare the command string TDIV? and transfer it to the oscilloscope. The command instructs the
oscilloscope to respond with the current setting of the timebase.
Read: Read the response of the oscilloscope and place it into the character string RD$.
This line holds the INCLUDE for the GPIB routines
address 4.
time base speed.
WM-RCM-E Rev D ISSUED: February 2005
19
P
ART ONE:
When running this sample program, the X-Stream DSO will automatically be set to the remote state when
IBWRT is executed, and will remain in that state. Here is a slightly modified version of the sample program
that checks if any error occurred during GPIB operation:
GPIB: ‘ This line should hold the INCLUDE for the GPIB routines
Address: DEV$ = “DEV4”
Find: CALL IBFIND (DEV$, SCOPE%) ‘ Find the DSO.
Send: CMD$ = “TDIV?” ‘ Time base query
CALL IBWRT (SCOPE%, CMD$) ‘ Send the string to the DSO.
ErrorS: IF IBSTA% < 0 THEN PRINT “WRITE ERROR =” ; IBERR% : END
Read: CALL IBRD (SCOPE%, RD$) ‘ Try to read a string from the
DSO.
ErrorR: IF IBSTA% < 0 THEN PRINT “READ ERROR =” ; IBERR% : END
PRINT RD$
190 END
The GPIB status word IBSTA%, the GPIB error variable IBERR% and the count variable IBCNT% are
defined by the GPIB handler and are updated with every GPIB function call. IBSTA% is negative if there is an
error, while IBERR% shows what type of error has occurred. IBCNT% is the number of bytes transferred.
Refer to the National Instruments manual for details. The sample program above would report an error if the
GPIB address of the oscilloscope was set to a value other then 4. When you are sending remote commands to
the DSO, the IBSTA% and IBERR% don’t necessarily indicate that the scope accepted the string, but merely
that the string was correctly transmitted to the DSO to interpret. To ensure that commands were valid, and
weren’t rejected by the DSO, use the Remote Control Assistant.
ABOUT REMOTE CONTROL
20
ISSUED: February 2005
WM-RCM-E Rev D
C
HAPTER TWO
USE ADDITIONAL DRIVER CALLS
IBLOC is used to execute the IEEE 488.1 standard message Go To Local (GTL); i.e., it returns the
oscilloscope 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 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 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 functions called IBRD and IBWRT are far less limited in
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 oscilloscope 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 X-Stream
DSO to arm the trigger system.
:
Control by GPIB
National Instruments supplies a number of additional function calls. In particular, it is possible to use the socalled board level calls, which allow a very detailed control of the GPIB.
NOTE: The SRQ bit is latched until the controller reads the 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 can be disabled by clearing the SRE register with the
*SRE 0 command.
WM-RCM-E Rev D ISSUED: February 2005
21
P
ART ONE:
MAKE SERVICE REQUESTS
When an X-Stream DSO is used in a remote application, events often occur asynchronously, i.e., at times that
are unpredictable for the host computer. The most common example of this is a trigger wait after the
oscilloscope is armed: 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 bits, refer to Chapter 5.
Perhaps a more efficient way of detecting events occurring in the oscilloscope 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 oscilloscope. 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 you 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.
In the default state, after power-on, the Service ReQuest is disabled. You enable SRQ by setting the Service
Request Enable register with the command “*SRE” and by specifying which event should generate an SRQ.
The X-Stream DSO 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, you may be required to identify which oscilloscope
caused the interrupt by serial polling the various devices.
ABOUT REMOTE CONTROL
Example: To assert SRQ in response to “new signal acquired.” This event is tracked by the INR register,
which is reflected in the SRE register as the INB summary bit in position 0. Since 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 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”
CALL IBWRT (SCOPE%, CMD$)
22
ISSUED: February 2005
WM-RCM-E Rev D
C
HAPTER TWO
:
Control by GPIB
Take Instrument Polls
You can regularly monitor state transitions within the oscilloscope by polling selected internal status registers.
There are four basic polling methods you can use to detect the occurrence of a given event: continuous, serial,
parallel, and *IST. By far the simplest of these is continuous polling. The others are appropriate only when
interrupt-service routines (servicing the SRQ line) are supported, or multiple devices on GPIB require constant
monitoring. To emphasize the differences between the methods, described below, the same example
(determining whether a new acquisition has taken place) is used in each case.
DO CONTINUOUS POLLING
A status register is continuously monitored until a transition is observed. This is the most straightforward
method for detecting state changes, but may not be practical 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
that a new waveform has been acquired. Reading INR clears this at the same time, so that there is no need for
an additional clearing action after a non-zero value has been detected. The command CHDR OFF instructs the
oscilloscope to omit any command headers when responding to a query, simplifying the decoding of the
response. The oscilloscope will then send “1” instead of “INR 1”:
CMD$ = “CHDR OFF”
CALL IBWRT (SCOPE%, CMD$)
MASK% = 1 ‘ New Signal Bit has value 1
DO
CMD$ = “INR?”
CALL IBWRT (SCOPE%, CMD$)
CALL IBRD (SCOPE%, RD$)
NEWSIG% = VAL (RD$) AND MASK%
LOOP UNTIL NEWSIG% = MASK%
WM-RCM-E Rev D ISSUED: February 2005
23
P
ART ONE:
TAKE A SERIAL POLL
Serial polling takes place once the SRQ interrupt line has been asserted, and is only advantageous when you are
using several oscilloscopes at once. The controller finds which oscilloscope has generated the interrupt by
inspecting the SRQ bit in the STB register of each. 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 oscilloscope
generated the interrupt. It will only exit if there was a timeout or if the oscilloscope (SCOPE%) generated
SRQ. The additional function call IBRSP fetches the value of the status byte, which may be further interpreted.
For this to work 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 oscilloscopes attached to the same interface
board. Refer to the National Instruments manual.
ABOUT REMOTE CONTROL
NOTE: After the serial poll is completed, the RQS bit in the 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
oscilloscope is reset. If these bits are not cleared, they cannot generate another interrupt
DO A PARALLEL POLL
Like serial polling, this is only useful when several oscilloscopes are connected. The controller simultaneously
reads the Individual STatus bit (IST) of all oscilloscopes to determine which one needs service. This method
allows up to eight different oscilloscopes to be polled at the same time.
When a parallel poll is initiated, each oscilloscope 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.
24
ISSUED: February 2005
.
WM-RCM-E Rev D
Loading...
+ 275 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.