Inspect? Command
Waveform? Command
Waveform Command
More Control of Waveform Queries
High-speed Waveform Transfer
Status Registers
Overview of Status and Service Request Reporting
Status Byte Register (STB)
Standard Event Status Register (ESR)
Standard Event Status Enable Register (ESE)
Service Request Enable Register (SRE)
Parallel Poll Enable Register (PRE)
Internal State Change Status Register (INR)
Internal State Change Enable Register (INE)
Command Error Status Register (CMR)
Device Dependent Error Status Register (DDR)
Execution Error Status Register (EXR)
User Request Status Register (URR)
35
35
37
37
179
179
180
182
187
188
188
191
193
194
195
195
195
195
196
196
196
196
196
|
|
|
Appendix A
Table of Contents
Example 1: Use of the Interactive
GPIB Program ’IBIC’
Example 2: GPIB Program for IBM PC
(High-level Function Calls)
Example 3: GPIB Program for IBM PC
(Low-level Function Calls)
Appendix B
The Waveform Template
199
200
202
205
1
GENERAL INFORMATION
INITIAL INSPECTION
WARRANTY
It is recommended that the shipment be thoroughly inspected immediately upon delivery to the purchaser. All material in the
container should be checked against the enclosed Packing List.
LeCroy cannot accept responsibility for shortages in comparison
with the Packing List unless notified promptly. If the shipment is
damaged in any way, please contact the Customer Service Depart-
ment or local field office immediately.
LeCroy warrants its oscilloscope products to operate within specifications under normal use for a period of two years from the date of
shipment. Spares, replacement parts and repairs are warranted for
90 days. The instrument’s firmware is thoroughly tested and
thought to be functional, but is supplied "as is" with no warranty of
any kind covering detailed performance. Products not manufac-
tured by LeCroy are covered solely by the warranty of the original
equipment manufacturer.
In exercising this warranty, LeCroy will repair or, at its option,
replace any product returned to the Customer Service Department
or an authorized service facility within the warranty period, provided that the warrantor’s examination discloses that the product
is defective due to workmanship or materials and that the defect
has not been caused by misuse, neglect, accident or abnormal conditions or operation.
The purchaser is responsible for transportation and insurance
charges for the return of products to the servicing facility. LeCroy
will return all in-warranty products with transportation prepaid.
This warranty is in lieu of all other warranties, expressed or implied, including but not limited to any implied warranty of
merchantability, fitness, or adequacy for any particular purpose or
use. LeCroy shall not be liable for any special, incidental, or con-
sequential damages, whether in contract or otherwise.
PRODUCT ASSISTANCE
MAINTENANCE
AGREEMENTS
Answers to questions concerning installation, calibration, and use
of LeCroy equipment are available from the Customer Service
Department, 700 Chestnut Ridge Road, Chestnut Ridge, New
York 10977-6499, U.S.A., tel. (914)578-6061, and 2, rue
(41)22/719 21 11, or your local field engineering office.
LeCroy offers a selection of customer support services. Maintenance agreements provide extended warranty and allow the
customer to budget maintenance costs after the initial two year
warranty has expired. Other services such as installation, training,
enhancements and on-site repair are available through specific
Supplemental Support Agreements.
General Information
DOCUMENTATION
DISCREPANCIES
SERVICE PROCEDURE
RETURN PROCEDURE
LeCroy is committed to providing state-of-the-art instrumenta-
tion and is continually refining and improving the performance of
its products. While physical modifications can be implemented
quite rapidly, the corrected documentation frequently requires
more time to produce. Consequently, this manual may not agree in
every detail with the accompanying product. There may be small
discrepancies in the values of components for the purposes of
pulse shape, timing, offset, etc., and, occasionally, minor logic
changes. Where any such inconsistencies exist, please be assured
that the unit is correct and incorporates the most up-to-date cir-
cuitry. In a similar way the firmware may undergo revision when
the instrument is serviced. Should this be the case, manual up-
dates will be made available as necessary.
Products requiring maintenance should be returned to the Cus-
tomer Service Department or authorized service facility. LeCroy
will repair or replace any product under warranty at no charge.
The purchaser is only responsible for transportation charges.
For all LeCroy products in need of repair after the warranty period, the customer must provide a Purchase Order Number before
repairs can be initiated. The customer will be billed for parts and
labor for the repair, as well as for shipping.
To determine your nearest authorized service facility, contact the
Customer Service Department or your field office. All products
returned for repair should be identified by the model and serial
numbers and include a description of the defect or failure, name
and phone number of the user, and, in the case of products returned to the factory, a Return Authorization Number (RAN).
The RAN may be obtained by contacting the Customer Service
Department in New York, tel. (914)578-6061, in Geneva, tel.
(41)22/719 21 11, or your nearest sales office.
Return shipments should be made prepaid. LeCroy will not accept
C.O.D. or Collect Return Shipments. Air-freight is generally recommended. Wherever possible, the original shipping carton
should be used. If a substitute carton is used, it should be rigid and
be packed such that the product is surrounded with a minimum of
four inches of excelsior or similar shock-absorbing material. In
addressing the shipment, it is important that the Return Authoriza-
tion Number be displayed on the outside of the container to ensure
its prompt routing to the proper department within LeCroy.
2
ABOUT REMOTE CONTROL
Two modes of operation are available in the oscilloscope. The in-
strument may be operated either manually, by using the
front-panel controls, or remotely by means of an external control-
ler (which is usually a computer, but may be a simple terminal).
This Remote Control Manual describes how to control the oscillo-
scope in the remote mode. For explanations on how to manually
set front-panel controls, refer to the Operator’s Manual.
The oscilloscope is remotely controlled via either the GPIB (Gen-
eral Purpose Interface Bus) or the RS-232-C communication
ports. Whenever the rear-panel GPIB address switches are set be-
tween 0 and 30, control is via GPIB; when they are at 31 or above,
control is via RS-232-C. The instrument can be fully controlled in
remote mode. The only actions which cannot be performed re-
motely are switching on the instrument or setting the remote
address.
This section introduces the basic remote control concepts which
are common to both RS-232-C and GPIB. It also presents a brief
description of remote control messages.
Sections 3 and 4 explain how to send program messages over the
GPIB or the RS-232-C interfaces, respectively. Section 5 alphabetically lists all the remote control commands. Section 6 is a
detailed description and tutorial of the transfer and format of
waveforms, whereas Section 7 explains the use of status bytes for
error reporting. Appendix A shows some complete programming
examples. Appendix B contains a printout of a waveform tem-
plate.
GPIB IMPLEMENTATION
STANDARD
PROGRAM MESSAGES
1.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.
The remote commands conform to the GPIB IEEE 488.2 stan-
1.
dard
IEEE 488.1 standard which dealt mainly with electrical and me-
chanical issues. The IEEE 488.2 recommendations have also
been adopted for RS-232-C communications whenever applica-
ble.
To remotely control the oscilloscope the controller must send pro-
gram messages which conform to precise format structures. The
instrument will execute all program messages which are in the cor-
rect form and ignore those where errors are detected.
This standard may be seen as an extension of the
About Remote Control
Warning or error messages are normally not reported by the instrument, unless the controller explicitly examines the relevant status
register, or if the status enable registers have been set in such a way
that the controller can be interrupted when an error occurs. The
status registers are explained in Section 7.
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
Program messages consist of one or several commands or queries.
A command directs the instrument to change its state, e.g. to
change its time base or vertical sensitivity. A query asks the instrument about its 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 time base to 2 msec/div, the controller
should send the following command to the instrument
TIME DIV 2 MS
To ask the instrument about its time base, 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" instruc-
tion to the GPIB or RS-232-C interface of the controller. The
response message to the query above might be
TIME DIV 10 NS
m
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, the controller may have to wait up to several seconds for
a response. Command interpretation does not have priority over
other oscilloscope activities. It is therefore judicious to set the controller IO timeout conditions to 3 or more seconds. In addition, it
must be remembered that an incorrect query message will not generate a response message.
4
About Remote Control 2
LOCAL AND REMOTE
STATE
PROGRAM MESSAGE
FORM
As a rule, remote commands are only executed by the instrument
when it is in the REMOTE state, whereas queries are always executed. A few commands which don’t affect the state of the front
panel are also executed in LOCAL (refer to the beginning of Section 5 for a list of these commands). When the instrument is in
REMOTE, all front-panel controls are disabled, except the lefthand menu buttons, the intensity controls (which can be disabled
with the command "INTENSITY") and the LOCAL button
(which can be disabled by setting the instrument to LOCAL
LOCKOUT). For an explanation on how to set the instrument to
LOCAL, REMOTE or LOCAL LOCKOUT, refer to Section 3 for
GPIB and to Section 4 for RS-232-C.
An instrument is remotely controlled with program messages
which consist of one or several commands or queries, separated by
semicolons <;> and ended by a terminator:
<command/query>; .........
Upper and/or lower case characters can be used for program messages.
The instrument does not decode an incoming program message
before a terminator has been received (exception: if the program
message is longer than the 256 byte input buffer of the instrument,
the oscilloscope starts analyzing the message when the buffer is
full). The commands or 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: The <EOI> signal is a dedicated GPIB interface line which
can be set with a special call to the GPIB interface driver. Refer to
the GPIB interface manufacturer’s manual and support programs.
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.
;<command/query> <terminator>
About Remote Control
|
|
Examples
COMMAND/QUERY
FORM
Example
GRID DUALThis program message consists of a
single command which instructs the
instrument to display a dual grid.
The terminator is not shown since it
is usually automatically added by
the interface driver routine which
writes to the GPIB (or RS-232).
BWL ON; DISPLAY OFF; DATE?
This program message consists of
two commands, followed by a
query. They instruct the instrument
to turn on the bandwidth limit, turn
off the display, and then ask for the
current date. Again, the terminator
is not shown.
The general form of a command or a query consists of a command
header <header> which is optionally followed by one or several
parameters <data> separated by commas:
<header>[?] <data> .....
The notation [?] shows that the question mark is optional (turning
the command into a query). The detailed listing of all commands
in Section 5 indicates which commands may also be queries.
There is a space between the header and the first parameter.
There are commas between parameters.
DATE 15,OCT,1989,13,21,16
<data>
This command instructs the oscillo-
scope to set its date and time to 15
OCT 1989, 13:21:16. The command header "DATE" indicates
the action, the 6 data values specify
it in detail.
|
|
|
|
I
1
I
|
|
|
1
Header
6
The header is the mnemonic form of the operation to be per-
formed by the oscilloscope. All command mnemonics are listed in
alphabetic order in Section 5.
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 used
interchangeably. For example, the following two commands for
switching to the automatic trigger mode are fully equivalent:
TRIG_MODE AUTO and TRMD AUTO
|
1
|
|
|
About Remote Control 2
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 <*>, e.g.
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
Example
Some commands or queries apply to a sub-section of the oscilloscope, e.g. 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 2-letter path name followed by a colon
<:> which immediately precedes the command header.
Usually one of the waveform traces can be specified in the header
path (refer to the individual commands listed in Section 5 for details on which values apply to a given command header):
C1, C2
C3, C4
MC, MD
FE, FFFunction E and F
EA, EB
EX, EX10External trigger
CI:OFST -300 MVSet the offset of Channel 1 to
Header paths need only be specified once. Subsequent commands
whose header destination is not indicated are assumed to refer to
the last defined path. For example, the following commands are
identical:
C2:VDIV?; C2:OFST?
C2:VDIV?; OFST?
Channels 1 and 2
Channels 3 and 4 (in 4-channel instruments)
Memory C and D
Expand A and B
-300 mV
What is the vertical sensitivity and
the offset of channel 2?
Same as above, without repeating
the path.
Data
Whenever a command/query uses additional data values, they are
expressed in terms of ASCII characters. There is a single excep-
tion: the transfer of waveforms with the command/query
"WAVEFORM", where the waveform may be expressed as a sequence of binary data values. Refer to Section 6 for a detailed
explanation of the format of waveforms.
ASCII data can have the form of character, numeric, string or
block data.
About Remote Control
|
|
Character data
Numeric Data
These are simple words or abbreviations for the indication of a
specific action.
BANDWIDTH LIMIT ONThe data value "ON" indicates that
the bandwidth limit should be
turned on, rather than off.
In some commands, where as many as a dozen different parame-
ters can be specified, or where not all parameters apply at the same
time, the format requires pairs of data values. The first one names
the parameter to be modified and the second gives its value. Only
those parameter pairs to be changed need to be indicated.
HARDCOPY_SETUP DEV,HP7470A,PORT,GPIB,PSIZE,A4
Three pairs of parameters are specified. The first specifies the device
as the H7470A plotter (or compatible), the second indicates the
GPIB port and the third requests
the A4 format for paper size. While
the command "HARDCOPY SET-
UP" allows many more parameters,
they are either not relevant for plot-
ters or they are left unchanged.
The numeric data type is used to enter quantitative information.
Numbers can be entered as integers, as fractions or in exponential
representation.
EA:VPOS -5Move the displayed trace of Expand A down-
wards by 5 divisions.
C2"OFST 3.56 Set the DC offset of Channel 2 to 3.56 V.
TDIV 5.0E-6 Adjust the time base to 5 issec/div.
Note: Numeric values may be followed by multipliers and units,
modifying the value of the numerical expression. The following
mnemonics are recognized:
|
|
|
|
|
|
|
|
|
II
|
II
II
II
|
|
i
About Remote Control 2
I
EX
l
l
I
T1E 12Tera-G1E9Giga-
MA1E6Mega-K1E3kilo-
M
N1E-9nano-PI1E-12
F1E-15femto-A1E-18atto-
For example, there are many ways of setting the time base of the
instrument to 5 ~tsec/div:
TDIV 5E-6
1E18
1E-3milli-U1E-6micro-
I
TDIV 5 US
l
TDIV 5000 NS
TDIV 5000E-3 US
String Data
This data type enables the transfer of a (long) string of characters
as a single parameter. String data are formed by simply enclosing
any sequence of ASCII characters between simple or double
quotes.
MESSAGE ’Connect probe to point J3’
The instrument displays this message in the Message field above
the grid.
Exa-
PE
Exponential notation, without any
suffix.
Suffix multiplier "U" for 1E-6,
with the (optional) suffix "S" for
seconds.
1E15
Peta-
pico-
Block Data
RESPONSE MESSAGE
FORM
These are binary data values coded in hexadecimal ASCII, i.e.
4-bit nibbles are translated into the digits 0,...9, A .... F and trans-
mitted as ASCII characters. They are only used for the transfer of
waveforms (command "WAVEFORM") and of the instrument
configuration (command "PANEL_SETUP")
The instrument sends a response message to the controller, as 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 ended by a terminator. They can be sent back to the instrument in the form in which
they are received, and will be accepted as valid commands. In
GPIB response messages, the <NL> <EOI> terminator is always
used.
For example, if the controller sends the program message:
TIME_DIV? ;TRIG_MODE NORM;C 1 :COUPLING? (terminator
not shown)
About Remote Control
|
|
the instrument might respond as follows:
TIME_DIV 50 NS;C 1:COUPLING D50 (terminator not shown)
The response message only refers to the queries, i.e.
"TRIG_MODE" is left out. If this response is sent back to the
instrument, it is a valid program message for setting its time base to
50 nsec/div and the input coupling of Channel 1 to 50 ~.
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 con-
troller may send program messages in upper or lower case
characters, response messages are always returned in upper case.
Program messages may contain extraneous spaces or tabs (white
space), response messages do not. Whereas program messages
may contain a mixture of short and long command/query headers,
response messages always use short headers as a default. However,
the instrument can be forced with the command
"COMM_HEADER" to use long headers or no headers at all. If
the response header is omitted, the response transfer time is mini-
mized, but such a response could not be sent back to the
instrument again. In this case suffix units are also suppressed in the
response.
If the trigger slope of Channel 1 is set to negative, the query
"CI:TRSL?" could yield the following responses:
CI:TRIG_SLOPE NEG
CI:TRSL NEG
NEG
Waveforms which are obtained from the instrument using the
query "WAVEFORM?" constitute a special kind of response mes-
sage. Their exact format can be controlled with the commands
"COMM FORMAT" and "COMM ORDER", as explained in
Section ~
header format: long
header format: short
header format: off
|
|
|
|
|
|
|
|
|
|
|
|
|
10
|
|
|
|
GPIB OPERATION
I
3
|
This section describes how to remotely control the oscilloscope via
the GPIB. Topics discussed include interface capabilities, addressing, standard bus commands, and polling schemes.
GPIB STRUCTURE
INTERFACE
CAPABILITIESThe interface capabilities of the oscilloscope include the following
The GPIB is like an ordinary computer bus, except that it interconnects independent devices via a cable bus whereas a computer
has its circuit cards interconnected via a backplane bus. The GPIB
carries program messages 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 Section 2.
¯
Interface messages manage the bus itself. They perform functions such as initializing the bus, addressing and unaddressing
devices and setting remote and local modes.
Devices on the GPIB can be listeners, talkers, and/or controllers.
A talker sends program messages to one or more listeners. A controller manages the flow of information on the bus by sending
interface messages to the devices.
The oscilloscope can be a talker or a listener, but not a controller.
The host computer, however, must be able to act as a listener,
talker and controller. For details on how the controller configures
the GPIB for specific functions, refer to the GPIB interface manufacturer’s manual.
IEEE 488.1 definitions:
AH1
SH1
L4
T5
SR1
RL1
DC1
DT1
PP1
CO
E2
Complete Acceptor Handshake
Complete Source Handshake
Partial Listener Function
Complete Talker Function
Complete Service Request Function
Complete Remote/Local Function
Complete Device Clear Function
Every device on the GPIB has an address. When the thumbwheel
address switches on the rear panel of the oscilloscope are set to a
value between 0 and 30, the instrument can be controlled via
GPIB. When the switches are set to above 30, the instrument can
execute talk-only operations on the GPIB, for example driving a
GPIB plotter. In this case no controller is present and the instrument is directly connected to the plotter. Addresses above 30 also
enable the instrument to be controlled via the RS-232-C port.
The instrument reads the address switches once at power on, or
when the RESET button on the rear panel is pressed. If the address is changed during operation, the instrument must be
powered again to enable the new address. The value of the GPIB
address appears in the menu "Auxiliary Setups".
If the oscilloscope is addressed to talk, it will remain configured to
talk until a universal untalk command (UNT), its own listen ad-
dress (MLA), or another instrument’s talk address is received.
Similarly, if the oscilloscope is addressed to listen, it will remain
configured to listen until a universal unlisten command (UNL),
its own talker address (MTA) is received.
The bus system consists of 16 signal lines and 8 ground or shield
lines. The signal lines are divided into 3 groups:
¯
8 data lines
¯
3 handshake lines
¯
5 interface management lines
II
n
i
l
l
l
II
II
Data Lines
Handshake Lines
Interface Management Lines
12
The eight data lines, usually called DI01 through DI08, carry both
program and interface messages. Most of the messages use the
7-bit ASCII code, in which case DI08 is unused.
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.
The following 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
false, the bus is in the data mode for the transfer of program messages from talkers to listeners.
IFC (InterFace Clear): The controller sets the IFC line true
initialize the bus.
II
II
II
n
II
g
g
II
n
|
|
GPIB Operation 3
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
IEEE 488.1
STANDARD MESSAGES
The instrument has a 256-byte input buffer and a 256-byte output
buffer. 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 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.
The IEEE 488.1 standard specifies not only the mechanical and
electrical aspects of the GPIB, but also the low-level transfer pro-
tocol, e.g. 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 of these messages (except GET) are executed immediately
upon reception and not in chronological order with normal com-
mands.
Note: In addition to the IEEE 488.1 interface message standards,
the IEEE 488.2 standard specifies some standardized program
messages, i.e. command headers. They are identified with a leading asterisk <*> and are listed among the commands in Section 5.
The command list in Section 5 does not contain any command for
clearing the input/output buffers or for setting the instrument to
the remote state. This is because such commands are already spe-
cified 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 describes those IEEE 488.1 standard messages
which go beyond mere reconfiguration of the bus and which have
an effect on the operation of the instrument.
Device Clear
In response to a universal Device CLear (DCL) or a Selected Device Clear message (SDC), the oscilloscope clears the input/output
13
GPIB Operation
buffers, aborts the interpretation of the current command (if any)
and clears any pending commands. Status registers and status en-
able registers are not cleared. Although DCL has an immediate
effect it can take several seconds to execute this command if the
instrument is busy.
I
I
I
I
Group Execute Trigger
Remote ENable
Local LOckout
Go To Local
The Group Execute Trigger message (GET) causes the oscillo-
scope to arm the trigger system. It is functionally identical to the
"*TRG" command.
This interface message is executed when the controller holds the
Remote ENable control line (REN) true and configures the instrument as a listener. The REMOTE LED on the front panel lights up
to indicate that the instrument is set to the remote mode. All the
front-panel controls are disabled except the left-hand menu but-
tons, the intensity controls and the LOCAL button. The menu
indications on the left-hand side of the screen no longer appear
since menus cannot now be operated manually. Whenever the
controller returns the REN line to false, all instruments on the bus
return to LOCAL. Individual instruments can be returned to LO-
CAL with the Go To Local message (see below).
As a rule, remote commands are only executed when the instru-
ment is in the remote state, whereas queries are always executed.
Local front-panel control may be regained by pressing the LO-
CAL push button, unless the instrument was placed in the Local
LOckout (LLO) mode.
The Local LOckout command (LLO) causes the LOCAL button
on the front panel of the oscilloscope to be disabled. 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.
The Go To Local message (GTL) causes the instrument to return
to the local mode. All front-panel controls become active and the
menus on the left-hand side of the screen reappear. Thereafter,
whenever the instrument is addressed as a listener it will be imme-
diately set to the remote state again.
Note that a GTL message does not clear the local lockout if it was
set. Thus, whenever the instrument returns to the remote state the
local lockout mode would immediately be effective again.
A command string should not be immediately followed by a GTL
message. Since GTL is executed at once, the instrument may already be returned to the local state before the commands in the
input buffer are interpreted. Therefore, the instrument may refuse
to execute them if they require the instrument to be in REMOTE.
I
I
I
I
I
I
I
I
I
I
I
I
14
I
I
GPIB Operation 3
A safe way to ensure that all commands have been interpreted is to
append a query (e.g. "*STB?") to the command string and to wait
for the response before sending a GTL.
InterFace Clear
PROGRAMMING
GPIB TRANSFERS
Configuring the
GPIB Hardware
The InterFace Clear message (IFC) initializes the GPIB but has
effect on the operation of the oscilloscope.
To illustrate the GPIB programming concepts a number of examples written in BASICA are included in this section. It is assumed
that the controller is IBM-PC compatible, running under DOS,
and that it is equipped with a National Instruments2 GPIB inter-
face card. GPIB programming with other languages such as C or
Pascal is quite similar.
If you use another computer or another GPIB interface, refer to
the interface manual for installation procedures and subroutine
calls similar to those described here.
Check that the GPIB interface is properly installed in the comput-
er. If it is not, follow the installation instructions of the interface
manufacturer. 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 our program examples, they are assumed to be left in
their default positions.
Connect the oscilloscope to the computer with a GPIB interface
cable. Set the GPIB address on the rear of the instrument to the
required value. The program examples assume that it is set to 4.
Remember to power the instrument up after setting the GPIB ad-
dress.
Configuring the
GPIB Driver Software
National Instruments Corporation,
2.
The host computer needs an interface driver which handles the
transactions between the user’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.
¯ installs in GPIB-PC a number of files and programs which are
useful for testing and reconfiguring the system, and for writing
user programs.
12109 Technology Boulevard, Austin, Texas 78727
15
GPIB Operation
The following files in the sub-directory GPIB-PC are of particular
use:
IBIC. EXE allows interactive control of the GPIB via functions en-
tered at the keyboard. Use of this program is highly recommended
to anyone who is not familiar with GPIB programming or with the
oscilloscope’s remote commands. An example of the use of
IBIC.EXE is shown in Appendix A.
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
user’s instructions to DECL.BAS and executing the complete file.
IBCONF.EXE is an interactive program which allows inspection
or modification of the current settings of the GPIB handler. To run
IBCONF.EXE, refer to the National Instruments user’s manual.
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 GPlB bus with
addresses between 1 and 16 can be called by the symbolic names
’DEVI’ to ’DEV16’.
Note: 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.
|
|
l
|
II
I
l
II
II
II
Simple Transfers
16
For a large number of remote control operations it is sufficient to
use just 3 different subroutines (IBFIND, IBRD and IBWRT) pro-
vided by National Instruments. The following complete program
reads the time-base setting of the oscilloscope and displays it on
the terminal:
1-99
100
110
120
130
140
150
160
<DECL.BAS>
DEV$="DEV4"
CALL IBFIND(DEV$,SCOPE%)
CMD$="TDIV?"
CALL IBWRT(SCOPE%,CMD$)
CALL IBRD(SCOPE%,RD$)
PRINT RD$
END
II
II
II
II
II
II
II
II
GPIB Operation 3
Explanation
Lines 1 - 99 are a copy of the file DECL.BAS supplied by National
Instruments. The first 6 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
sample program above only uses the strings CMD$ and RD$ which
are declared in DECL.BAS as arrays of 255 characters.
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.
Note: The first 2 lines of DECL.BAS each contain a string
"XXXXX" which must be replaced by the number of bytes which
determine the maximum workspace for BASICA (computed by
subtracting the 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 59000 or less.
Lines 100 and 110 open the device "DEV4" and associate with it
the descriptor "SCOPE%". All I/O calls from now on will refer to
"SCOPE%". The default configuration of the GPIB handler recog-
"DEV4"
nizes
If you want to use another GPIB address between 1 and 16, use
the string "DEVx" with x = 1...16. If you want to use another
name, run IBCONF.EXE to declare this name to the handler.
Lines 120 and 130 prepare the command string TDIV? and trans-
fer it to the instrument. The command instructs it to respond with
the current setting of the time base.
Line 140 reads the response of the instrument and places it into
the character string RD$.
Line 150 displays the response on the terminal.
When running this sample program, the oscilloscope will automati-
cally be set to the remote state when IBWRT is executed, and will
remain in that state. Pressing the LOCAL button on the front pan-
el 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:
and associates with it a device with GPIB address 4.
17
GPIB Operation
|
|
Some Additional
Driver Calls
1-99
100
110
120
130
140
150
160
170
180
190
200
210
25O
260
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 Na-
tional Instruments user’s 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.
Example 2 in Appendix A provides a more useful program which
enables interactive setting and inspection of the front-panel controis as well as archiving and recalling of waveforms. Note that this
program is written with just 7 different GPIB calls.
IBLOC is used to execute the IEEE 488.1 standard message Go
To Local (GTL), i.e. it returns the instrument to the local state.
The programming example above shows its use.
IBCLR executes the IEEE 488.1 standard message Selected De-
vice Clear (SDC).
IBRDF and IBWRTF allow data to be read from GPIB to a file
and data to be written from a file to GPIB respectively. Transferring data directly to or from a storage device does not limit the size
of the data block, but it may be slower than transferring to the
computer memory. Example 2 in Appendix A shows the use of
these calls.
IBRDI and IBWRTI allow data to be read from GPIB to an integer array and data to be written from an integer array to GPIB.
Since the integer array allows storage of up to 64 kilobytes (in BA-
SIC), IBRDI and IBWRTI should be used for the transfer of large
<DECL.BAS>
DEV$=" DEV4"
CALL IBFIND(DEV$,SCOPE%)
CMD$="TDIV?"
CALL IBWRT(SCOPE%,CMD$)
IF ISTA% < 0 THEN GOTO 200
CALL IBRD(SCOPE%,RD$)
IF ISTA% < 0 THEN GOTO 250
PRINT RD$
IBLOC(SCOPE%)
END
PRINT "WRITE ERROR = ";IBERR%
END
PRINT "READ ERROR = ";IBERR%
END
I
II
l
I
il
II
n
l
ii
m
ii
il
II
n
18
ti
II
PROGRAMMING
SERVICE REQUESTS
GPIB Operation 3
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 the function
calls IBRD and IBWRT for more modem programming languages,
such as C, are much less limited in the data block size.
IBTMO can be used to change the time-out value during program
execution. The default value of the GPIB driver is 10 seconds, e.g.
if the instrument does not respond to a 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. The use of such
calls is shown in Example 3 of Appendix A.
When an oscilloscope is used in a remote application, events often
occur asynchronously, i.e. at times that are unpredictable for the
host computer. The most common case is waiting for a trigger after
the instrument has been 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
continuously or periodically reading the status bit associated with it
until the required transition is detected. Continuous status bit poll-
ing is described in more detail in the sub-section "Instrument
Polls". For a complete explanation of the status bytes refer to Section 7.
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. Therefore, the controller can execute other programs
while waiting for the instrument. Unfortunately, not all interface
manufacturers support the programming of interrupt service routines. In particular, National Instruments only supports 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.
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 con-
19
GPIB Operation
3
troller 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 have to identify which instrument caused the inter-
rupt by serial polling the various devices.
Note: The SRQ bit is latched until the controller reads the STatus
Byte Register (STB). The action of reading the STB with the com-
mand "*STB?" clears the register contents except the MAV bit
(bit 4) until a new event occurs. Service requesting may be dis-
abled by clearing the SRE register ("*SRE 0").
|
|
II
II
l
Example 1
Example 2
To assert SRQ in response to the events "new signal acquired"
or "return-to-local" (pressing the front-panel button LO-
CAL).
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 which may be summa-
rized in the INB bit must be specified. The event "new signal
acquired" corresponds to INE bit 0 (value 1) while the event "re-
turn-to-local" is assigned to INE bit 2 (value 4). The total sum
1+4=5. Thus the command "INE 5" is needed.
CMD$="INE 5;*SRE 1"
CALL IBWRT(SCOPE%,CMD$)
To assert SRQ when soft key 10 is pressed.
The event "soft key 10 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 gener-
ated 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$)
l
I
I
II
l
l
I!
n
II
2O
II
II
II
II
GPIB Operation 3
INSTRUMENT POLLS
Continuous Poll
State transitions occurring within the instrument can be remotely
monitored by polling selected internal status registers. This subsection discusses a number of polling methods which may be used
to detect the occurrence of a given event.
1.Continuous poll
2.Serial poll
Parallel poll
3.
4.*IST poll
To emphasize the differences between these methods, the same
example will be presented in each case, i.e. determining if a new
acquisition has taken place. By far the simplest poll is the continuous poll. The other methods only make sense if interrupt service
routines (servicing the SRQ line) are supported or if multiple devices on GPIB must be monitored simultaneously.
In 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 be impracticable in
some situations, especially in multiple device configurations.
In the following example, the event "new signal acquired" is ob-
served by continuously polling the INternal state change Register
(INR) until the corresponding bit (in this case bit 0, i.e. value 1)
non-zero to indicate that a new waveform has been acquired.
Reading INR clears it 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 instrument to
omit any command headers when responding to a query. This simplifies the decoding of the response. The instrument would
therefore send "1" rather than "INR 1".
CMD$="CHDR OFF"
CALL IBWRT(SCOPE%,CMD$)
MASK% = 1
LOOP% = 1
WHILE LOOP%
CMD$="INR?"
CALL IBWRT(SCOPE%,CMD$)
CALL IBRD(SCOPE%,RD$)
NEWSIG% = VAL(RD$) AND MASK%
IF NEWSIG% = MASK% THEN LOOP% = 0
WEND
’New Signal Bit has value 1
21
GPIB Operation
3
|
|
Serial Poll
Serial polling takes place once the SRQ interrupt line has been
asserted. The controller examines which instrument has generated
the interrupt by inspecting the SRQ bit in the STB register of each
instrument. Because service request is based on an interrupt mech-
anism, 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 occur: &Hg000 in the mask (MASK%) corresponds to a GPIB error, &H4000 to a time-out 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 time-out 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
example to function properly the value of ’Disable Auto Serial
Polling’ must be set ’off’ in the GPIB handler (use IBCONF.EXE
to check).
CMD$="*CLS; INE 1; *SRE 1"
CALL IBWRT(SCOPE%,CMD$)
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 instrument is reset. If these bits are not cleared, they cannot
generate another interrupt.
Serial polling is only an advantage if there are several instruments
that may need attention. Board-level function calls can deal simul-
taneously with several instruments attached to the same interface
board. Refer to the National Instruments user’s manual.
II
II
I
II
II
l
II
l
l
l
II
II
II
22
I
II
|
GPIB Operation 3
Parallel PollParallel polling is only an advantage if there are several instru-
ments that may need attention.
In parallel polling, the controller simultaneously reads the Individ-
ual STatus bit (IST) of all the instruments to determine which one
needs service. Since parallel polling allows up to eight different
instruments to be polled at the same time, parallel polling is the
fastest way to identify state changes of instruments supporting this
capability.
When a parallel poll is initiated, each instrument returns a status
bit via 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 via 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 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 con-
troller for parallel poll and instruct the oscilloscope to respond
Note 1: In the example above, board-level GPIB function calls
are used. It is assumed that the controller (board) and oscillo-
scope (device) are respectively located at addresses 0 and 4. The
listener and talker addresses for the controller and oscilloscope
are:
*IST Poll
Logic device
controller
oscilloscope
Note 2: The characters "?" and .... appearing in the command
strings stand for unlisten and untalkrespectively. They are used to
set the devices to a "known" state.
Note 3: To shorten the size of the program examples, device talk-
ing and listening initialization instructions have been grouped into
character chains. They are:
CMDI$ = "?_@$" ’Unlisten, Untalk, PC talker, DSO listener
Note 4: 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.
The state of the Individual STatus bit (IST) returned in parallel
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.
Listener address
32 (ASCII<space>)
32+4=36 (ASCII $)
Talker address
64 (ASCII @)
64+4=68 (ASCII D)
24
Loading...
+ 202 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.