Text preview for : 501_904_01C.pdf part of Keithley 501 904 01C Keithley 501 501_904_01C.pdf



Back to : 501_904_01C.pdf | Home

SERIES 500 GPIB IEEE Controller

Includes D500GPIB Software Driver




Publication Date: January 1990
Document Number: 501-904-01 Rev. C
Table of Contents
Chapter 1: Intrcduction
1.1 Description.. .............................................................. 1.1
1.2 Specifications.. ........................................................... 1.2
1.3 Abbreviations.. ........................................................... 1.3

Chapter 2: Installation
2.1 Inspection .................................................................
2.2 Hardware Installation.. .................................................. 2:.
2.2.1 IEEE Adress Selection.. ......................................... 2.3
2.2.2 IEEE Bus Terminator Selection.. .............................. .2.3
2.2.3 Series 500 Installation Instructions.. .......................... .2.5
2.2.4 System 570 Installation Instructions.. ......................... 2.5
2.3 Software Installation.. .................................................. .2.6

Chapter 3: Getting Started
3.1 Using DSOOGPIB with BASIC.. ..................................... 3.1
3.1.1 Initializing the System.. ......................................... 3.1
3.1.2 Configuring the 195 DMM ..................................... 3.3
3.1.3 Taking Readings.. ............................................... .3.3
3.1.4 Polling for Status.. ............................................... 3.4
3.1.5 The Complete BASIC Sample Program.. ..................... 3.6

Chapter 4: Data Transfers
4.1 Terminators.. ............................................................. 4.1
4.1.1 The End-Of-Line (EOL) Terminators.. ........................ 4.1
4.1.2 The TERM Terminators.. ....................................... 4.2
Bus OUTPUT.. ......................................................... 4.3
Z Bus ENTER.. ........................................................... 4.3

Chapter 5: IEEE Operating Modes
5.1 Introduction.. ............................................................ .5.1
5.2 Operating Mode Transitions.. .......................................... 5.2
5.3 The GPIB Module as System Controller.. ........................... .5.3

Chapter 6: Command Set
6.1 Introduction.. ............................................................ .6.1
6.2 Command Description Format.. ....................................... 6.2
6.2.1 Syntax.. ........................................................... 6.2
6.2.1.1 Bus Addressing.. ......................................... 6.3
6.2.1.2 Character Count.. ......................................... 6.3
6.2.1.3 ASCII Characters.. ....................................... 6.3
6.2.1.4 ASCII Character Strings.. ............................... 6.4
6.2.1.5 Terminators.. .............................................. 6.4
6.2.2 Response.. ........................................................ 6.4
6.2.4 Bus States.. ....................................................... 6.5
6.2.5 Examples.. ........................................................ 6.5
6.3 The Commands.. ........................................................
ABORT ................................................................... 2
CLEAR.. ................................................................. 617
ENTER.. ................................................................. 6.8
HELLO.. .................................................................. 6.10
IOCTL .................................................................... 6.11
IOCTL$. .................................................................. 6.12
LOCAL.. ................................................................. 6.13
LOCAL LOCKOUT ................................................... 6.14
OUTPUT.. ............................................................... 6.15
PPOLL.. .................................................................. 6.16
PPOLL CONFIG ....................................................... 6.17
PPOLL DISABLE ...................................................... 6.18
PPOLL UNCONFIG .................................................. 6.19
REMOTE.. ............................................................... 6.20
RESUME.. ............................................................... 6.21
SEND.. ................................................................... 6.22
SPOLL.. .................................................................. 6.24
TERM.. ................................................................... 6.25
TIME OUT.. ............................................................. 6.27
TRIGGER.. .............................................................. 6.67

Chapter 7:IEEE 488 Primer
7.1 History.. .................................................................. 7.1
7.2 General Structure.. ...................................................... 7.1
7.3 Send It To My Address.. ............................................... 7.2
7.4 Bus Management Lines.. ............................................... 7.2
7.4.1 Attention (ATN). ................................................. 7.2
7.4.2 Interface Clear (IFC). ........................................... .7.2
7.4.3 Remote Enable (REN). .......................................... 7.4
7.4.4 End or Identify (EOI). ........................................... 7.4
7.4.5 Service Request (SRQ). ......................................... 7.4
7.5 Handshake Lines.. ...................................................... .7.4
7.5.1 Data Valid (DAV). ............................................... .7.4
7.52 Not Ready for Data (NRFD). .................................. 7.4
7.5.3 Not Data Accepted (NDAC). ................................... .7.5
7.6 Data Lines.. .............................................................. .7.5
7.7 Multiline Commands.. .................................................. 7.5
7.7.1 Go To Local (GTL). ............................................. 7.5
7.7.2 Listen Address Group (LAG). ................................. .7.6
7.7.3 Unlisten (UNL). .................................................. 7.6
7.7.4 Talk Address Group (TAG). ................................... .7.6
7.7.5 Untalk (UNT). ................................................... .7.6
7.7.6 Local Lockout (LLO). ........................................... 7.6
7.7.7 Device Clear (DCL). ............................................. 7.6
7.7.8 Selected Device Clear (SDC). .................................. .7.6
7.7.9 Serial Poll Disable (SPD). ...................................... .7.6
7.7.10 Serial Poll Enable (SPE) ....................................... 7.7
7.7.11 Group Execute Trigger (GET) ................................ 7.7
7.7.12 Take Control (TCT). ........................................... 7.7
7.7.13 Secondary Command Group (SCG). ........................ 7.7
7.7.14 Parallel Poll Configure (PPC). ............................... .7.7

2
7.7.15 Parallel Poll Unconfigure (PPU) . . .. . .. . ... . .. . .. . .. . .. .. . .. 7.7
7.8 More on Service Requests . .. . . .. . .. . . . .. . .. . . . .. . . .. .. . .. . . . .. . . .. . . . .. 7.7
7.8.1 Serial Poll . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.8
7.8.2 Parallel Poll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. .. . . . . . . . . . . . . . . . . . . . . . 7.8

Appendix A: Keyboard Controller Program . . .. .. .. . . .. .. . .. .. . .. . .. . .. .. . .. .. . .. A.1

Appendix B: Character Codes and IEEE Multiline Messages ... ... ... ... . . . B. 1

Appendix C: Command Summary . .. . . .. . . . . .. . . .. .. . . .. .. . . . .. . . .. .. . . .. .. . . .. . . . C.l
Chapter 1 Introduction


Introduction

1.1 Description
The Series 500 GPIB Controller consists of the DSOOGPIB software, the GPIB interface
module, the installation program provide with your system (INSTALL), and other utility programs.
Together, they provide a full implementation of the IEEE 488-1978 bus including advanced
capabilities such as Parallel Poll, Serial Poll, Secondary Addressing, and automatic error detection.

DSOOGPIB is the software interface between DOS and the GPIB controller module. It can be
accessed by virtually any language that can communicate with DOS files. The examples in this
manual are primarily for BASICA, or other similar BASICS (such as GW BASIC), but DSOOGPIB is
compatible with most languages for the PC. Some examples are Aztec C, Microsoft C and Foraan,
Turbo Pascal, as well as Microsoft QuickBASIC.
D5OOGPIB receives simple, high-level commands from the program and carries them out using
the necessary IEEE bus control and handshaking.




1.1
Chapter I Introduction


1.2 Specifications

IEEE 488-1978 Interface

SHl, AHl, T6, TEO, LA, LEO, SRl, PPO, RLO, DCl, DTl, CO, El/2
Controller subsets: Cl, C2, C3, C4 and Cl0
Terminator: Software selectable characters and/or EOI
Connector: Standard Amphenol 57-20240 with metric studs


GPIB Interface Module

IEEE Controller Device: TI 9914
Speed: Software and IEEE device dependent
Environment: 0 to 35 Celsius, 0 to 70% RH
Fits in slot 10 of Series 500 or expansion slot of System 570

DSOCGPIB Device Driver Software

Memory Size: 16 Kbytes
Command Set: More than 20 commands providing complete IEEE bus control
Operating Modes: Bus Controller modes only
DOS Compatibility: MS-DOS or PC-DOS 3.1 or higher

Specifications subject to change without notice




1.2
Chapter 1 Introduction



1.3 Abbreviations
The following IEEE 488 abbreviations are used throughout this manual.

addr n IEEE bus address "n"
ATN Attention line
Controller Active
:;: Carriage Return
data Data String
DCL Device Clear
GET Group Execute Trigger
GTL Go To Local
LA Listener Active
LAG Listen Address Group
Line Feed
ZO Local Lock Out
MLA My Listen Address
MIA My Talk Address
PPC Parallel Poll Configure
PPU Parallel Poll Unconfigure
System Controller
& Selected Device Clear
SPD Serial Poll Disable
SPE Serial Poll Enable
SRQ Service Request
TA Talker Active
TAD Talker Address
TCI Take Control
term Terminator
UNL Unlisten
UNT Untalk
* Unasserted




1.3
Chapter 2 Installation



Installation
2.1 Inspection

The Keithley Series 500 GPIB system, including the GPIB interface module and the
DSOOGPIB software, are carefully inspected, both mechanically and electrically, prior to
shipment. When you receive the product, carefully unpack all items from the shipping carton and
check for any obvious signs of physical damage which may have occurred during shipment.
Immediately report any such damage found to the shipping agent. Remember to retain all
shipping materials in the event that shipment back to the factory becomes necessary.


2.2 Hardware Installation

To use the D500GPIB software, you must have a GPIB interface module installed in your
Series 500 or System 570. The module has a bracket that must be installed and switches that
must be positioned correctly before installing it into your system. The following sections will
discuss those things pertaining to either the Series 500 or System 570. This section details
those things needed for either one.

The dip switches on the GPIB module set the configuration of the interface. Most of the
selectable functions are read only at power up and should be set prior to applying power. The
figure on the next page illustrates the factory default settings. To modify any of these defaults,
follow this simple procedure. Turn the power off on the Series 500 or System 570 and modify the
switch settings as specified on the following pages. When the switch setting modifications are
complete, turn the system power back on, It will usually be necessary to reinitialize any
software that is being used to control the module as well. This can easily be done if the software
uses an IOCTL command near the beginning of the program. This command will be explained in
detail later, but make a mental note of it for now.

As you can see from the illustration, there are two parameters that can be controlled via
these switch settings. They are the IEEE bus address and the type of terminator used at the
end of a bus transmission (including EOI if required). The factory defaults are IEEE address21
(a good starting point since it is infrequently used by bus devices), and a terminator of CR LF
with EOI set with the linefeed. This is practically an industry standard and is accepted by most
instruments supplied by Keithley. If any of these settings are not suitable, then refer to the
following sections for detailed information on how to modify them.




2. 1
Chapter 2 Installation




Factory Default Switch Settings


IEEE Term EOI
IEEE Ad& (21) CR LF enabled




1' 1 2 3 4 5 6 7 8




Component side of board




2. 2
Chapter 2 Installation



2.2.1 IEEE Address Selection

Switches 1 through 5 select the IEEE bus address as the SYSTEM CONTROLLER. The
address is selected by simple binary weighting with switch 1 being the least significant bit and switch
5 being the most significant bit. The factory default is 21. The following is an example of how you
might change the bus address to 08.


NOTE: That the switch logic is "low-true", i.e.




"ON" = Logic 0
"OFF" = Logic 1



0 x 20
ox
ox
1 x 23
+ 0x2 4


= a



2.2.2 IEEE Bus Terminator Selection
Switches 6 through 8 set the IEEE bus terminator used for data which is sent to an instrument
on the bus. These are the only switch selectable parameters that can be modified under software
control (using the TERM command). As mentioned earlier, the factory default terminators are CR LF
(carriage return line feed) with EOI set on the line feed. Refer to the next page for all the various
switch configurations and their meanings.


2. 3
Chapter 2 Installation




12345678 12345678

L-J LJ
IEEE Term IEEE Term
CR only LF only




L-J
IEEE Term
L-J
IEEE Term
LF CR CR LF




'12345678 112345678

v
EOI Enabled
v
EOI Disabled




2. 4
Chapter 2 Installation



2.2.3 Series 500 Installation Instructions
The GPIB interface module is installed into expansion slots inside the Series 500
mainframe. The GPIB interface module may be installed into any vacant slot of a Series 500 but
slot 10 is the only one we recommend. The reason for this is that the mounting bracket supplied
with the module can only be used with slot 10. This bracket provides additional stability to the
module which is needed due to the bulky, stiff IEEE cables used to connect instruments to the
module.

Install the long L shaped mounting bracket supplied with the GPIB module using the
screws provided. The bracket should be attached to the soldered (non component) side of the
module with the short tab facing away from the card. The hole in this tab is designed to line up
with an existing screw in the base of your Series 500 mainframe near slot 10.

After attaching the bracket you are ready to install the module in the Series 500. Insert
the GPIB interface module into the expansion slot as follows: Make sure the Series 500 is
turned off, and unplug the power cord. Unscrew the cover mounting screws on the rear of the
unit. Remove the system unit cover by sliding it backward and tilting it up.

First look at the base of the Series 500 near slot 10. You should see the screw towards
the back of the unit that is used to secure the metal cover plate. Remove this screw and set it
aside. Carefully insert the GPIB interface module into expansion slot 10. With the board firmly
in place, fix its mounting bracket to the metal panel in the base of the unit using the longer screw
provided with the module. The original screw that was in the base unit can not be used because
it is too short.

Finally, slide the system unit cover back on, reattach it with its screws, plug it back in,
and turn it on.

2.2.4 System 570 Installation Instructions
The GPIB interface module is installed into the single expansion slot in the System 570.
A special mounting bracket is supplied with the module that replaces the existing bracket in the
rear of the 570. This bracket provides additional stability to the module which is needed due to
the bulky, stiff IEEE cables used to connect instruments to the module.

First remove the existing stabilizing bracket from the rear panel of the System 570. Save
the screws since they will be used to mount the GPIB module mounting bracket. Install the
short angled bracket supplied with the GPIB module using the screws provided. The bracket
should be attached to the soldered (non component) side of the card. The holes in this bracket
are designed to line up with the holes on the module and the existing holes for the original 570
bracket.



2. 5
Chapter 2 Installation


After attaching the bracket you are ready to install the module in the System 570. Insert
the GPIB interface module into the expansion slot as follows: Make sure the System 570 is
turned off. Carefully insert the GPIB interface module into the expansion slot. With the board
firmly in place, fix its mounting bracket to the metal panel in the rear of the unit using the screws
provided with the original 570 bracket.

Finally, turn the power back on on the System 570 and close the cover.

2.3 Software Installation
Once the GPIB interface board has been configured and installed, the software must be
installed. The DSOOGPIB software is included on the Software disk that comes with the GPIB
Board. Before installing the software driver for the GPIB card you must know the following:

1. The address of the Keithley IBIN interface card used with the data acquisition system which
holds the GPIB card.
2. The slot number (1 through 10) that the GPIB card occupies in the data acquisition system.

To complete the installation you must edit your DOS AUTOEXECBAT file to include the
following line:

GPIB-PATH -1 IBIN-ADDR -S SLOT-NUM


where:

GPIB-PATH is a complete DOS file specification to the Series 500 GPIB driver
(DGPIBSOO.COM).

IBIN-ADDR is the address of the IBIN card specified in hexadecimal format
(e.g. OxCFF8).

SLOT-NUM is the slot number of the GPIB card (1 through 10).

Note: A space character must separate both the IBIN address and Slot Number from the
command line flags of -I and -S respectively. For example:

c:~~OO\D~OOGPIB.COM -1 Oxcff8 -S 10

c:\DSOOGPIB.COM -I OXDFF8 -S OxA

Optionally, you can create a batch file with the above information in it which you run prior
to using the Series 500 GPIB device. In this way yhe driver is only resident in memory when
needed freeing up system RAM for your utilities.



2. 6
Chapter 2 Installation


When the driver is installed properly, it will display a signon message with copyright notice as
follows:

DSOOGPIB Rev nxx (C) Copyright 1987 Keithley DAC

After it is installed you can try the following program . ..

10 OPEN "\dev\GPIBOUT" FOR OUTPUT AS 1
20 OPEN "\dev\GPIBIN" FOR INPUT AS 2
30 PRINT #l,"HELLO"
40 LINE INPUT #2,A$ : PRINT A$

The GPIB will respond with (and the host computer will display):

SERIES 500/488 Rev n.xx (C) Copyright IOtech Inc

If you obtain the above response, (or something very similar) then your GPIB module and
the D 5 0 0 GP IB software are working well together. If you did not receive the above message,
then you should contact our applications staff for assistance.

Now that the hardware and software are working properly, you can begin to use the rest
of the commands to control your IEEE bus peripherals. The following command descriptions
each have examples showing their use. You may also like to familiarize yourself with the
various commands using the "dumb" terminal program provided on the disc (TBRMGPIB.BAS).




2. 7
Chapter 3 Getting Started


Getting Started

Introduction
Once DSOCGPIB has been installed in your system, it is ready to begin controlling IEEE bus
devices. To show how this is done, we will develop a short program, in BASIC, to control a
Keithley Instruments Model 195 digital multimeter. The techniques used in this program are quite
general, and will apply to the control of most instruments.


3.1 Using DSOOGPIB with BASIC
3.1.1 Initializing the System
Any program using DSOOGPIB must first establish communications with the software driver.
In BASIC and most other languages this is accomplished using an OPEN statement. Communications
both to and from DSOCGPIB are required. In BASIC, this means that two files must be opened, one
for input, and one for output. Other languages may allow the same file to be opened for both input
and output. Three file names are allowed: "WEV\GPIBOUT", `WEV\GPIBIN". and WEVYIPIB".
By convention, they are used for output, input, and both input and output, respectively, but actually,
they are all really the same and any one of them can be used for input, output, or both, depending on
the programming language.
In BASIC, the files are opened with the following commands:

110 OPEN ~~\DEV\GPIB~UT~~ FOR OUTPUT AS #l
200 OPEN *~\DEV\GPIBIN" FOR INPUT AS #2


Of course, the line numbers and the file numbers may change as desired, but throughout this
manual, file #l will be assumed to output to D5OOGPIB, and file #2 will be assumed to input from
DSOOGPIB.

Once these files are opened, we can send commands and receive responses from DSOOGPIB.
While DSOOGPIB should normally be in a reset, quiescent state, it is possible that is was left in some
unknownstateby a previousprogram failure error or from a power up. In order to force DSCOGPIB
into its quiescent state we can use the IOCTL statement:

160 IOCTL#l,"BREAK"

IOCTL is a BASIC statement that sends commands through a "back door" to DSOOGPIB.
DXNXIPIB recognizes this "back door" command regardless of what else it might be doing and resets
itself so that it is ready to accept a normal command.

The IOCTL BREAK command guarantees that DSOOGPIB is ready for action. Note that the IOCTL
BREAK command is executed before file #2 is opened for input from D5OOGPIB. This guarantees
compatibility with the various versions of BASIC.


3.1
Chapter 3 Getting Started


With the initialization commands and some comments, the program now appears as follows:

100 'Establish communications with D500GPIB
110 OPEN ~~\DEV\GPIBOUT~~ FOR OUTPUT AS #l
150 'Reset D5OOGPIB
160 IOCTL#l,"BREAK"
190 'Open file to read responses from D5OOGPIB
200 OPEN -~\DEV\GPIBIN~~ FOR INPUT AS 82
Once everything is reset, we can test the communications and read the Driver488 revision
number with the HELLO command:

310 PRINT#l,"HELLO"
320 INPUT#2,A$
330 PRINT A$


First we PRINT the HELLO command to tile #I, then we INPUT the response from file #2 into the
character string variable A$ ("A-string"). Finally we display the response with a PRINT to the
screen. Because BASIC cannot both PRINT and INPUT from the same file, we use two OPEN
statements, and two different file numbers to communicate with D5OOGPIB. PRINT must reference
the file opened for output (in these examples, file #l) and INPUT must reference the file opened for
input (file #2). Attempting to communicate with the wrong file (e.g. INPUT#l) will result in an
error.

It is not necessary to perform the HELLO command,but is included here as a simple example
of normal communication with DSOOGPIB. Its response is the revision identification of the
Driver488 software ("DSOOGPIB Rev n.n (C) Copyright Keithley Instruments Inc.").


3.1.2 Configuring the 195 DMM
Once the system is initialized we are ready to start issuing bus commands. The IEEE bus has
already been cleared by the Interface Clear (IFC) that was sent by the BREAK command, and so we
know that all the bus devices are waiting for the controller to take some action. In the normal state,
IEEE bus devices are controlled from their front panel or keyboard. They are not normally enabled to
accept commands from the IEEE bus. To set them into the remote mode, so that they can accept bus
commands, they must be addressed to listen while the Remote Enable (REN) line is asserted. The
REMOTE command accomplishes this:

510 PRINT#l,"REMOTE 16"
where 16 is the bus device address of the bus device we wish to control (in this case a Keithley
Instruments Model 195 digital multimeter).
Now that the 195 is ready to accept commands, we can control any of its features. For
example, the command "FOROX" command sets the 195 to read DC volts with automatic range
selection:

610 PRINT#l,"OUTPUT 16;FOROX"

3.2
Chapter 3 Getting Started


The OUTPUT command takes a bus device address (16 in this case) and data ("FOROX") and
sends the data to the specified device. The address can be just a primary address, such as 12, or 05,
or it can include a secondary address: 1201. Note that both the primary address and, if present, the
secondary address are two-digit decimal numbers. A leading zero must be used, if needed to make
the address two digits long.


3.1.3 Taking Readings
Once we have set the 195's operating mode, we can take a reading and display it:

710 PRINT#l,"ENTER 16"
720 INPUT#2,R$
730 PRINT R$

The ENTER command takes a bus address (with an optional secondary address) and configures
that bus device so that it is able to send data (addressed to talk). No data is actually transferred,
however, until the INPUT statement requests the result from D5OOGPIB at which time data is
transferred to the program into the variable R$.

Once the result has been received, any BASIC functions or statements can be used to modify or
interpret it. In this example the result will be in the form "NDCV+1.23456E-2" showing the range
("NDCV") and the numeric value of the reading ("+1.23456E-2"). The BASIC MID$ function can
be used to strip off the range characters and keep only the numeric part (the fifth character and
beyond), and the VAL function can be used to convert this string to a number:


740 N$=MID$(R$,S)
741 N=VAL(N$)
742 PRINT "The read value is";N
These may be combined for efficiency:

740 PRINT "The read value is";VAL(MID$(R$,5))
All the power of BASIC may be used to manipulate, print, store, and analyze the data read
7;;" the IEEE bus. For example, the following statements print the average of ten readings from the


810 SUM=0
820 FOR I=1 TO 10
830 PRINT#l,"ENTER 16"
840 INPUT#2,R$
850 SUM=SUM+VAL(MIDS(R$,5))
860 NEXT I
870 PRINT "The average of ten readings is";SUM/lO




3.3
Chapter 3 Getting Started



3.1.4 Polling for Status
The IEEE bus is designed to be. able to attend to asynchronous (i.e. unpredictable) events or
conditions. When such an event occurs, the bus device needing attention can assert the Service
Request (SRQ) line to signal that condition to the controller. Once the controller notices the SRQ, it
can interrogate the bus devices, using Parallel Poll and/or Serial Poll to determine the source and
cause of the SRQ, and take the appropriate action.
Parallel Poll is the fastest method of determining which device requires service. Parallel Poll is
a very short, simple IEEE bus transaction that quickly returns the status from many devices. Each of
the eight IEEE bus data bits can holds the Parallel Poll response from one or more devices. So, if
there are eight or fewer devices on the bus, then just the single Parallel Poll can determine which
requires service. Even if the bus is occupied by the full complement of 15 devices, then Parallel Poll
can narrow the possibilities down to a choice of at most two.

Unfortunately, the utility of Parallel Poll is limited when working with actual devices. Some
have no Parallel Poll response capability. Others must be configured in hardware, usually with
switches or jumpers, to set their Parallel Poll response. If Parallel Poll is not available, or several
devices share the same Parallel Poll response bit, then Serial Polling will still be required to determine
which device is requesting service.

Serial Poll, though it is not as fast as Parallel Poll, does offer two major advantages: It returns
additional status information beyond the simple request/no-request for service, and it is implemented
on virtually all bus devices.
The SRQ line can be monitored by using the SPOLL command.
The 195 can be set to request service on any of several different internal conditions. In
particular, the Ml command will cause an SRQ when a reading has been completed by the 195:

540 PRINT#l,"OUTPUT 16;MlX"
This OUTPUT command is placed just after the 195 is placed in remote mode so that each reading
taken by the 195 will cause an SRQ if it is valid.

At this point BASIC can check for an SRQ using a Serial Poll subroutine. We will also read the
Serial Poll Status of the 195 to determine if there are any errors.

1999 '
2000 'Serial Poll routine used to check for reading
2001 `completed as well as any other errors !!! !!!!
2010 '
2050 `Check for an SRQ - wait until it occurs
2060 PRINT#l,"SPOLL"
2070 INPUT#2,SP
2080 IF SP=O THEN GOT0 2060
Next we Serial Poll the 195 to determine its status. If there were other devices on the bus that could
be generating the SRQ, then each of them would be have to be checked in turn.


3.4
Chapter 3 Getting Started


2110 PRINT#l,"SPOLL 16"
2120 INPUT#2,ST195
2130 IF (ST195 AND 64) = 0 THEN PRINT "Non-195 SRQ!": STOP
Bit D107, with a value of 64, is returned as true (1) in the Serial Poll response of those devices
requesting service. In our simple example we expect that the 195 is the only possible cause of an
SRQ, and if it is not the cause then there must he some error.
Now that we have identified the device that is requesting service, we can further examine the
Serial Poll status to classify the request. If DI05 is set, then the 195 is signaling an error condition.
If that bit is clear, then some non-error condition caused the SRQ:

2160 IF ST195 AND 32 THEN 2300 'Test ERROR Status Bit

2210 IF ST195 AND 1 THEN PRINT "Overflow"
2220 IF ST195 AND 2 THEN PRINT "Buffer Full"
2230 IF ST195 AND 4 THEN PRINT "Buffer l/2 Full"
2240 IF ST195 AND 8 THEN PRINT "Reading Done"
2250 IF ST195 AND 16 THEN PRINT "Busy"
2260 GOT0 2400
2310 IF ST195 AND 1 THEN PRINT "Illegal Command Option"
2320 IF ST195 AND 2 THEN PRINT "Illegal Command"
2330 IF ST195 AND 4 THEN PRINT "No Remote"
2340 IF ST195 AND 8 THEN PRINT "Trigger Overrun"
2350 IF ST195 AND 16 THEN PRINT "Failed Selftest"
Finally, once we have diagnosed the error, we are ready to return to the main program:

2400 RETURN




3.5
Chapter 3 Getting Started


3.1 .5 The Complete BASIC Sample Program
This program is provided on the Supplemenatal disk as "DEM0195.BAS"

100 'Establish communications with DSOOGPIB
110 OPEN ~~\DEv\GPIB~uT~~ FOR OUTPUT AS #l
120 '
150 'Reset DSOOGPIB
160 IOCTLR1,"BREAK"
180 '
190 'Open file to read responses from D500GPIB
200 OPEN ~\DEV\GPIBIN" FOR INPUT AS #2
290 '
300 'Read the signon and revision message
310 PRINT#l,"HELLO"
320 INPUT#2,A$
330 PRINT A$
340 '
500 'Put the 195 (assuming bus address 16) into REMOTE
510 PRINT#l,"REMOTE 16"
520 '
530 'Enable 195 SRQ on Data Aquired
540 PRINT#l,"OUTPUT 16;MlX"
550 '
600 'Set 195 to Autorange, DC Volts
610 PRINT#l,"OUTPUT 16;FOROX"
620 '
700 'Display a reading here - wait for it!
705 GOSUB 1999
710 PRINT#l,"ENTER 16"
720 INPUT#2,RS
730 PRINT R$
740 PRINT "The read value is";VAL(MID$(R$,5))
790 '
800 'Find the average of 10 readings
810 SUM=0
820 FOR I=1 TO 10
830 GOSUB 1999
835 PRINT#l,"ENTER 16"
840 INPUT#2,R$
850 SUM=SUM+VAL(MID$(R$,5))
860 NEXT I
870 PRINT "The average of ten readings is";SUM/lO
1900 END
1999 '
2000 'Serial Poll routine used to check for reading
2001 'completed as well as any other errors !!!! !!!
2010 '
2050 'Check for an SRQ - wait until it occurs
2060 PRINT#l,"SPOLL"
2070 INPUT82,SP

3.6
Chapter 3 Getting Started


2080 IF SP=O THEN GOT0 2060
2090 '
2100 'Check the 195 Serial Poll status
2110 PRINT#l,"SPOLL 16"
2120 INPUT#2,ST195
2130 IF (ST195 AND 64) = 0 THEN PRINT "Non-195 SRQ!": STOP
2140 '
2150 'Test for 195 ERROR
2160 IF ST195 AND 32 THEN 2300 'ERROR STATUS BIT
2170 '
2200 'Interpret no-error status
2210 IF ST195 AND 1 THEN PRINT "Overflow"
2220 IF ST195 AND 2 THEN PRINT "Buffer Full"
2230 IF ST195 AND 4 THEN PRINT "Buffer l/2 Full"
2240 IF ST195 AND 8 THEN PRINT "Reading Done"
2250 IF ST195 AND 16 THEN PRINT "Busy"
2260 GOT0 2400
2270 '
2300 'Interpret error status
2310 IF ST195 AND 1 THEN PRINT "Illegal Command Option"
2320 IF ST195 AND 2 THEN PRINT "Illegal Command"
2330 IF ST195 AND 4 THEN PRINT "No Remote"
2340 IF ST195 AND 8 THEN PRINT "Trigger Overrun"
2350 IF ST195 AND 16 THEN PRINT "Failed Selftest"
2360 '
2390 'Return to main program
2400 RETURN




3.1
Chapter 4 Data Transfers


Data Transfers
4.1 Terminators
The following section deals with the subject of terminators in a general sense. Under normal
cicumstances you will have no need to know how terminators effect your programing. If you are
interested please read on, however this information is not needed to get started.

Every transfer of data, between a program and DSOOGPIB, or between DSOOGPIB and a bus
device, must have a definite end. This is a common requirement in most systems. For example,
most printers will not print a line until they have received the carriage-return that ends that line.
Similarly, a BASIC INPUT statement will wait for the Enter key to be pressed before returning the
entered data to the program. The only time that some terminator is not required is when the number
of characters that compose the data is known in advance. This is the case, for example, when reading
fixed-length records from a random access disk file.

There are actually four terminators used by DSOOGPIB:

The end-of-line (EOL) terminator for output from the program to DSOOGPIB.

The end-of-line (EOL) terminator for input to the program from DSOOGPIB.

The data terminator (TERM) for output to bus devices from DSOGGPIB.

The data termina,tor (TERM) to input from bus devices into D50OGPIB.


4.1.1 The End-Of-Line (EOL) Terminators
The EOL terminators mark the end of character strings transferred between the user's program
and DSOOGPIB. The EOL output terminator marks the end of strings transferred from the user's
program to DSOOGPIB, and the EOL input terminator marks the end of strings transferred into the
user's program from DSOOGPIB.

The EOL terminators consist of two ASCII characters each. These characters default to
carriage return and line feed and can not be modified under program control. It turns out that these
terminators serve well for the vast majority of languages and are particularly useful1 for BASIC.
The EOL output terminator is sensed by DSOOGPIB to detect the end of a command or, in the
case of the OUTPUT...; data command, the end of the data. Most commands have many different
variations. It is the EOL output terminator that lets DSOOGPIB known when the command has been
completely received and is ready for execution. Without the EOL output terminator there would be no
way of determining when one command ends and the next begins.

The EOL input terminator is provided by D5OOGPIB to the user's program so that the program
will be able to detect the end of a response. BASIC needs to receive a carriage return, line feed
combination when using the INPUT statement to receive a response from DSOOGPIB. DSOOGPIB
automatically provides this EOL input terminator to the program.

As mentioned previously, the EOL output terminator is used to delimit the data portion of an

4.1
Chapter 4 Data Transfers


OUTPUT command. If, in the OUTPUT command, no character count is specified, then the EOL
output terminator does delimit data, but if a character count is specified, then DSOOGPIB will accept
exactly that number of characters from the program for output to the bus, even if the EOL output
terminator is among those characters. Furthermore, if a character count is not specified, then the
TERM output terminator will he sent to the bus devices after the data. If a character count is
specified, then nothing will be sent to the bus except the exact characters that were sent from the
program. For example PRINT# 1, l~~~~~~~lO;A~C1~ sends ABC to
device 10: while PRINT#l, "OUTPUT~~#~; DEF" sends DEF to device 10 because
BASIC will send carriage return, line feed () at the end of the command., and a character
count of 5 was specified.


4.1.2 The TERM Terminators
Just as the EOL terminators delimit the end of strings transferred between the user's program
and DXlOGPIB, the TERM terminators delimit the end of strings transferred between DSOflGPIB and
bus devices. The TERM output terminator marks the end of strings transferred from DSOOGPIB to
bus devices, and the TERM input terminator marks the end of strings transferred into DSOOGPIB
from bus devices. One, major difference between EOL and TERM is that TERM is programable while
EOL is not. TERM input is, however, much like EOL in that it defaults to LF (linefeed) hut can be
modified on a "one shot" basis by appending the desired terminator to the end of the ENTER
command. TERM output defaults to the values specied by the switch settings, but can be modified by
the TERM command to D5COGPIB.
The TERM terminators differ from the EOL terminators in one important aspect. While the
EOL terminators are composed of one or two characters, the TERM terminators can include the IEEE
bus signal EOI. The EOI signal, when asserted during a character transfer, marks that character as
the last of the transfer. This allows the detection of the end of data regardless of what characters
compose the data. This feature is very useful in binary data transfers which might very well contain
any ASCII values from 0 to 255.

During normal OUTPUT, without a specified character count or buffer, the EOL output
terminator received by DSOOGPIB is replaced by the TERM output terminator before sending the data
to the bus devices. During normal ENTER the TERM input terminator received by D50OGPIB is
replaced with the EOL input terminator before being returned to the program. In this way, the
program communicates with DSOOGPIB using the EOL terminators, and D5OOGPIB communicates
with bus devices using the TERM terminators.

See the ENTER and OUTPUT command descriptions below and in Chapter 6 for more details.




4.2
Chapter 4 Data Transfers



4.2 Bus OUTPUT
The OUTPUT command sends data to bus devices. For example, the statement

PRINT#l,"OUTPUT 05;SPl;"

will send the characters "SPl;"cTERM output> to device 5. This is an example of direct I/O as the
data is communicated directly to the DSOOGPIB through the PRINT statement. As discussed above,
DSOOGPIB recognizes the EOL output terminator as the end of the data and sends the TERM output
terminator in its place after sending the data. Binary direct output is also possible. For example,
the following statements send all 256 ASCII characters:

PRINT#l,"OUTPUT 05 #256;";
FOR I=0 TO 255
PRINT#l,CHR$(I);
NEXT I
The first statement tells DSOOGPIB to expect 256 characters to follow that are to be sent to
device 5. Note the semicolon just after the #256. This marks the end of the actual OUTPUT
command and the start of the data. The semicolon at the end of the line tells BASIC not to send
anything else, such as the normal carriage return, line feed combination, after sending the quoted
characters. The next three lines send the 256 ASCII characters from 0 to 255 in order to DSOOGPIB
for transfer to device 5. The semicolon at the end of the third line has the same function as the
semicolon at the end of the first line: it prevents BASIC from sending any extra characters. In this
example we are performing a binary transfer. DSOOGPIB knows how many characters are to be
transferred and neither requires EOL output terminators to end the command, nor sends TERM output
terminators to the bus device. The data is transferred to the bus device exactly as sent from the
program.


4.3 Bus ENTER
The ENTER command is used to read data from bus devices. For example, the commands

PRINT#l,"ENTER 16"
INPUT#2,A$

read data from device 16 and store the returned data in the A$ variable. This is an example of direct
ENTER input as the data received from the bus is read into the program via the INPUT statement that
reads the result directly from D5OKlPIB. As discussed above, DSOOGPIB will accept data from
device 16 until it detects the TERM input terminator. It returns the replaces the TERM input
terminator with the EOL output terminator and returns the result to the program. BASIC accepts the
data just as it accepts character data from any file. This allows us to use thevarieties of BASIC input
statements to control how the data is received. For example, if the data read form the device is in the
form of a valid number then we can read it as a number:




4.3
Chapter 4 Data Transfers



PRINT#l, "ENTER 16"
INPUT#2,N
Or, if the data consists of several values separated by commas, then we can read it as several values:

PRINT#l,"ENTER 16"
INPUT#2,A$,N,B$,I
Or, if we want to read the entire input, even if it includes commas or other special characters, we can
use LINE INPUT:

PRINT#l,"ENTER 16"
LINE INPUT#2,L$
Finally, just as we can perform direct binary OUTPUT, we can also perform binary direct ENTER:

PRINT#l,"ENTER 16#128"
A$=INPUT$(128,2)

When performing a binary ENTER, DSOOGPIB does not check for TERM input terminators when
reading from the bus. The data is returned to the program just as it is received from the bus device.
The INPUTS function which is designed to read a specific number of characters from a file or device
is ideal for reading the result from DSOOGPIB. A normal INPUT statement will also work, as
DSOOGPIB even provides the EOL input terminators on binary ENTERS, however, the transfer may
be terminated abnormally if the EOL sequence occurs within the data.




4.4
Chapter 5 IEEE Operating Modes


IEEE ODeratinP Modes
5.1 Introduction
The following section deals with the subject of IEEE operating modes in a general sense.
Under normal cicumstances you will have no need to know these modes since the GPIB module can
only act as the system controller and all other devices must therfore be peripherals. If you are
interested please read on, however this information is not needed to get started.

Although the GPIB module can only be the System Controller it is useful1 to discuss the modes
that can occur on the IEEE bus. There are actually four types of IEEE bus devices: Active
Controllers, Peripherals, Talk-only devices, and Listen-always devices. Talk-only and Listen-always
devices arc usually used together, in simple systems, such as a Talk-only digitizer sending results to a
Listen-always plotter. In these simple systems no controller is needed because the talker assumes that
it is the only talker on the bus, and the listener(s) assume that they are all supposed to receive all the
data send over the bus. This is a simple and effective method of transferring data from one device
and another, but is not adequate for more complex systems where, for example, one computer is
controlling many different bus devices.

In more complex systems, the Active Controller sends commands to the various bus
Peripherals telling them what to do. Commands such as Unlisten, Listen Address Group, Untalk,
and Talk Address Group are sent by the controller to specify which device is to send data, and which
are to receive it. For more details about the IEEE bus protocols see Chapter 7.

When an IEEE bus system is first turned on, some device must be the Active Controller. This
device is the System Controller and always keeps some control of the bus. In particular, the System
Controller controls the Interface Clear (IFC) and Remote Enable (REN) bus management lines. By
asserting Interface Clear, the System Controller forces all the other bus devices to stop their bus
operations, and regains control as the Active Controller.

5.2 Operating Mode Transitions
The System Controller is initially the Active Controller. It can, if desired, Pass Control to
another device and thereby make that device the Active Controller. Note that the System Controller
remains the System Controller, even when it is not the Active Controller. (NOTE: The GPIB module
currently does not implement the Pass Control feature.) Of course, the device to which control is
passed must bc capable of taking on the role of Active Controller. It would make no sense to try to
pass control to a printer. Control should only be. passed to other computers that are capable, and
ready, to become the Active Controller. Further, note that there must be exactly one System
Controller on the IEEE bus. All other potential controller must be configured as Peripherals when
they power up.
The state diagram below shows the relationships between the various operating modes. The
top half of the state diagram shows the two operating states of a System Controller. At power on, it
is the active controller. It directs the bus transfers by sending the bus commands mentioned
previously. It also has control of the Interface Clear and Remote Enable bus lines. The System
Controller can pulse Interface Clear to reset all of the other bus devices.



5.1
Chapter 5 IEEE Operating Modes




IEEE Bus Operating Modes State Diagram
As shown in the diagram,the System Controller can pass control to some other bus device and
thereby become a Peripheral to the new Active Controller. If the System Controller receives control
from the new Active Controller, then it will once again become the Active Controller. The System
Controller can also force the Active Controller to relinquish control by asserting the Interface Clear
signal.

The bottom half of the state diagram shows the two operating states of a Not System Controller
device. At power on, it is a Peripheral to the System Controller which is the Active Controller. If it
receives control from the Active Controller, then it becomes the new Active Controller. Even though
it is the Active Controller, it is still not the System Controller. The System Controller can force the
Active Controller to give up control by asserting Interface Clear. The Active Controller can also give
up control by Passing Control to another device, which may or may not be the System Controller.




5.2
Chapter 5 IEEE Operating Modes


In summary, a bus device is set in hardware as either the sole System Controller in the system,
or as a non-System Controller. At power on, the System Controller is the Active Controller, and the
other devices are Peripherals. The System Controller can give up control by Passing Control, and
can regain control by asserting Interface Clear, or by receiving control. A Peripheral can become the
Active Controller by receiving control, and can give up control by Passing Control, or upon detecting
Interface Clear.


5.3 The GPIB Module as System Controller
The most common DSOOGPIB configuration is as the System Controller, controlling several
IEEE bus instruments. In this mode, DSOOGPIB can perform all of the various IEEE bus protocols
necessary control and communicate with any IEEE 488 bus devices. As the System Controller in the
Active Controller mode, DSOOGPIB can use all of the commands available for the Active Controller
state. ~1~s control the Interface Clear and Remote Enable lines. The allowed bus commands and their
actions are as follows:

ABORT Pulse Interface Clear.

LOCAL Unassert Remote Enable, or send Go To Local to selected devices.
REMOTE Assert Remote Enable, optionally setting devices to Remote.

LOCALLOCKOUT Prevent local (front-panel) control of bus devices.

CLEAR Clear all or selected devices.
TRIGGER Trigger selected devices.

ENTER Receive data from a bus device.
OUTPUT Send data to bus devices.

SPOLL Serial Poll a bus device, or check the Service Request state.
PPOLL Parallel Poll the bus.
PPOLLCONFIG Configure Parallel Poll responses.
PPOLLDISABLE Disable the Parallel Poll response of selected bus devices.
PPOLLUNCONFIG Disable the Parallel Poll response of all bus devices.

SEND Send low-level bus sequences.
RESUME Unassert Attention. Used to allow Peripheral-to-Peripheral transfers.




5.3
Chapter 6 Command Descriptions


Command Descriptions
6.1 Introduction
This chapter contains a detailed listing of each of the high-level commands available for
D500GPIB. There are two types of commands: bus commands, and system commands. Bus
commands communicate with the IEEE 488 bus. System commands configure or request information
from DSOOGPIB.

Bus Commands:

ABORT PPOLL DISABLE
CLEAR PPOLL UNCONFIG
ENTER REMOTE
LOCAL REQUEST
LOCAL LOCKOUT RESUME
OUTPUT SEND
SPOLL PPOLL
PPOLL CONFIG TRIGGER


System Commands:


HELLO
TERM iE%JT


6.2 Command Description Format
Each command description is divided into several areas as follows:


6.2.1 Syntax
The syntax section of the command description describes the proper command syntax which
must be sent to DSOOGPIB using the BASIC PRINT# command or its equivalent in other languages.
The following conventions are used in the syntax descriptions:

No command may be more than 255 characters long. The data part of the
OUTPUT command does not count in this length and so the OUTPUT data may be
as long as necessary.

Items in capital letters, such as ENTER or OUTPUT must be used exactly as stated.

Items in lower case, such as addr or count represent parameters which must be
substituted with an appropriate value.


6.1
Chapter 6 Command Descriptions


Blank spaces in commands are generally ignored. Thus, LOCAL LOCK OUT is the
same as LOCALLOCKOUT. Spaces arc not ignored in three places: the data part of
an OUTPUT command, within quoted strings in a SEND command, and after an
apostrophe ( ' ) in a terminator specification (term).

The number sign character (#) and the semi-colon (;) must be present exactly as
shown. A comma (, ) represents an address separator. The oblique or slash
character (/) may be used in its place as the address separator.

Items enclosed in square brackets ([item] ) are optional. Multiple items enclosed
in square brackets separated by vertical lines ([item1 I item2 1item3]) are
optional, any one or none may be chosen. No more than one item may be selected.

Ellipses (-) within square brackets mean that the items in the brackets may be
repeated as many times as desired. For example [, addr...] means that any
number of address separator-address combinations may be used.

Braces, or curly brackets, ({ item1 1 item2 }) mean that exactly one of the
enclosed items is required.

Combinations of brackets are possible. For example, (term[term] [EOI]
IEOI) allows the choice of term, term EOI, term term, term term EOI, or
just EOI, but does not allow the choice of "nothing."

Several of the commands require additional or optional parameters. These are further described with
each command, but the more common ones are discussed below.




6.2
Chapter 6 Command Descriptions


6.2.1 .l Bus Addressing
pri-addr A two-digit primary device address in the range of 0 0 to 3 0.

set-addr An optional two-digit secondary device address in the range of 00
to31.

addr An IEEE bus address. Bus addresses optionally include a
secondary address. Thus they are of the form
pri-addr [ set-addr] where pri-addr is a two-digit
primary address in the range from 00 through 30 and set-addr
is a two-digit secondary address from 00 through 31. Addresses
must be given as two-digit numbers, e.g. 05 for address 5, and
160 1 for primary address 16, secondary address 1

[, addr...] An optional list of bus addresses, each one preceded by an address
separator; either a comma (, ) or a slash (/).
No more than 15 bus addresses are allowed in any single
command.


6.2.1.2 Character Count
#count The number of characters to be transferred. A pound sign (#)
followed by an integer in the range of 1 to 65535 (216-1). A
character count of zero is invalid.


6.2.1.3 ASCII Characters
Schar A single character whose ASCII value is the number char, a
decimal number in the range of 0 to 255 For example, $65 is the
letter "A".

CR The carriage return character ($13).

LF The line feed character ($10).

'X Any (usually) printable character. The apostrophe is immediately
followed, without any intervening spaces, by a single character
which is taken to be the character specified.




6.3
Chapter 6 Command Descriptions




6.2.1.4 ASCII Character Strings
data An arbitrary string of characters. None of the special forms given
above (Schar, CR, LF, or `X) are used. For example, CRLF as
data is taken as the letters, "C", "R", "L", and "F", not as
carriage return line feed.

`data' An arbitrary string of characters enclosed in apostrophes.


6.2.1.5 Terminators
term Any single character, specified as CR, LF, 'X, or $char as
described above ({CR 1LF 1 ' X 1 Schar }). Part of terminator
sequence used to mark the end of lines of data and commands.

[term] An optional term character. term [term] means that one or two
terminators may be specified.

EOI The IEEE bus End-Or-Identify signal. When asserted during the
transfer of a character, EOI signals that that character is the last in
the transfer. On input, EOI, if spe