Text preview for : 24821B(DV488).pdf part of Keithley 24821B(DV488) Keithley Misc 24821B(DV488).pdf



Back to : 24821B(DV488).pdf | Home

DV-488
IEEE-488 Interface Board




Keithley MetraByte Corporation
A Subsidiary of Keithle Instruments, Inc.
440 Myles &andish Boulevard
Taunton, Massachusetts 02780
Part Number: 24821
First Printing: June 1989

Copyrt ht 0 1989
%Y
Keithley MetraB te Corporation
440 Myles Stan&sh Boulevard
Taunton, Massachusetts 02780




II WARNING
Keithley MetraByte Corporation assumes no liability for dama f es cons eyeyt tothe use of
this product. This product is not designed with components o a level o rehabihty suitable II




All rights reserved. No part of this publication may be re reduced, stored in a retrieval.system,
or transmitted, in an form by any means, electronic, met R anical, photoco ying, recording or
otherwise, without t Ke express written permission of Keithley MetraByte e orporation.
Information furnished by MetraB to be accurate and reliable. How-
ever, no responsibility is assum for its use; nor for an infringe-
ments of patents or other rights result from its use. No yi tense is
granted by implication or otherwise un ts of Keithley MetraByte Corporation.


MetraByte TMis a trademark of Keithley MetraByte Corporation.
IBM 0 is a registered trademark of International Business Machines Corporation.
Microsoft 8 is a registered trademark of Microsoft Corporation.
WARRANTYINFORhfATION

All products manufactured b Keithley MetraByte are warranted against defective materials
and workmanship for a peno of v
4 from the date of delive to the original purchaser.
Any roduct found to be defective wtthin the warranty period WI , at the option o Kerthley
fx
Metra lf yte, be repaired or replaced. This warranty does not apply to products which have been
damaged by improper use.
TABLE OF CONTENTS

1.0 INTRODUCTION
General Description (MBC-488 & uCMBC-488) 1

2.0 INSTALLATION (Hardware)
MBC-488 & IBM PC/XT/AT
uCMBC-488 & PS/2
Modifying the @5018ADF File
z
5
PSI2 Installation Errors 5

3.0 DEVICE DRIVER (DV488)
Introduction & General Overview
Installing DV488 Device Driver
Program Mode of Operation
Direct Memory Access Mode of Operation
Data Transfer Sequence

4.0 GPIB PROGRAMMING with DV488
Programming and Device Driver Access
Image Specifiers & Terminators ;
Command Structure & Syntax 9
Device Driver Commands
DV488 Error Messages :II
Programmed Data Transfer 19
BASICA Example Program 20
DMA Command Syntax 24
Determing the Status of a DMA Operation
QuickBASIC Example Program ;z

5.0 IBM PC/XT SPECIFIC PROGRAMMING STRUCTURE
DMA Data Transfer
IBM PC/XT Memory Page Boundaries
DMA Transfers in BASIC
z:
32

6.0 PS/2 PROGRAMMING STRUCTURE
uCMBC-488 DMA Data Transfer
DMA Data Transfers in BASIC

7.0 MBC-488 HARDWARE STRUCTURE
MBC-488 Register I/O Map
MBC-488 Interrupts & DMA
MBC-488 Specifications

8.0 uCMBC-488 HARDWARE STRUCTURE
uCMBC-488 Register I/O Map
uCMBC-488 Interrupts & DMA ii
uCMBC-488 Specifications 41
9.0 APPENDICES
APPENDIX A IEEE-488 Standard
APPENDIX B IEEE-488 Interface Messages
APPENDIX C File Listing for IBM PC/XT/AT Diskette
APPENDIX D File Listing for IBM PS/2 Diskette
APPENDIX E Installing the Line Printer Driver
IEEE-488 Standard
IEEE-488 Interface Messages
APPENDIX C File Listing for IBM PC/XT/AT Diskette
APPENDIX D File Listing for IBM PS/2 Diskette
APPENDIX E Installing the Line Printer Driver
1.0 IiVZ'RODUCZ'ION

General Description (MBC-488 & uCMBC-488)

MetraByte's MBC-488 and uCMBC-488 are General Purpose Instrument Bus (GPIB) interface
cards conforming to the IEEE-488 standard (November 1978 and later. See Appendix A). The
MBC-488 or uCMBC-488 plug directly into any IBM PC/XT/AT expansion slot (including the
PC/XT short slot J8) as well as virtually any other PC bus compatible or the IBM PW. The
(uC)MBC-488 is supplied with a standard IEEE-488 interface connector. It can be configured as
a controller, talker or listener and supports the 12 interface messages applicable to the IEEE-488
standard (See Appendix B). Full software support (DV488PC.SYS & DV488UCSYS), via DOS
device drivers, is supplied with the both boards (PC and uChanne1 Bus compatible boards). The
DV488 software allows interfacing with up to 14 other devices and provides system timing and
interrupt control (when applicable) for complete GPIB operation.

The hardware and supporting software allow Programmed and Direct Memory Access (DMA)
data transfer with data transfer rates of 2 KBytes/Sec in programmed mode and 400 KBytes/Sec
in DMA mode, The supplied device drivers are general purpose in nature and may be used to
interface with virtually any high and low level computer language supporting device drivers.
Example routines in various languages (C, FORTRAN, BASIC, TurboPASCAL, and QuickBA-
SIC, etc.) are provided and may be listed and/or copied as desired.

(uC)MBC-488 configuration and installation is quick and easy with the IBM PC version being
configured with hardware switches and the PS/2 version being configured via the PS/2's Setup
and Installation programs supplied.



Product Returns and RMA Procedure
MetraByte's warranty and product return policies are fully described in the MetraByte Product
catalog. In the unlikely event that you wish to return any MetraByte product, whether for repair,
replacement, or any other reason, you must fist call the Technical Support Department
(508-880-3000) between the hours of 9:00 AM and 4:30 PM to receive a Return Materials
Authorization (RMA) number. This assures that your account will be properly credited (for
product returns) and/or allows MetraByte to track your products to better serve you in the event
that you require support or service.
2.0 INSTALLATION

MBC-488 & the IBM PC/XT/AT

MetraByte's MBC-488 board uses 16 consecutive address locations in the IBM PC's I/O address
space. Some I/O address locations will be occupied by internal I/O and other peripheral cards.
The base address of the MBC-488 can be set by the Base Address DIP switch to any 16-bit
boundary. This address space extends from decimal 256-1023 (Hex lOO-3FF). The table below
summarizes the usual address assignments and is reproduced from the "IBM Technical
Reference Manual":
ADDRESS (Hex) DEVICE ADDRESS (hex) DEVICE

OO@OFF Internal system 378-37F LPTl:
200-20F Game 380-38C SDLC comm.
210-217 Expansion unit 380-389 Binary comm. 2
220.24F Reserved 3AO-3A9 Binary comm. 1
278-27F Reserved 3BO-3BF Mono dsp/LPTl :
2FO-2F7 LPT2: 3CO-3CF Reserved
2F8-2FF COM2: 3DO-3DF Color graphics
300-31F Prototype card 3EO-3E7 Reserved
320-32 Hard disk 3FO-3F7 Floppy disk
3F8-3F COMl:
This list covers the standard I/O options. You may, however, have other peripherals e.g. hard
disk drives, graphics boards, etc. that use I/O address space. Check the manuals that came with
your other peripherals to avoid address conflicts. Review the above list and choose an address
space 16-bits wide and set it via the Base Address DIP switch. The DV488 device driver
(supplied) supports 2 MBC-488 boards. If you are using more than one MBC-488 board,
separate Base Addresses are required to avoid address conflicts.

A second DIP switch (marked DMAANT) is to the left of the Base Address switch and controls
selection of DMA level, interrupts and operation in the J8 short slot of an IBM PC/XT. The first
slider selects the DMA level. There are 4 DMA levels provided by the internal (PC) 8237 DMA
controller. Level 0 is used internally by the system for memory refresh and is not available.
Levels 1, 2 and 3 are available, with level 2 usually being used by the floppy disk drive. Level 1
is usually available, and level 3 is available on standard IBM PC (without hard disk) or IBM
PC/AT. On the XT model, level 3 is used by the hard disk. Select the DMA level desired and
set the switch accordingly. The MBC-488 can be operated in non-DMA modes in the rightmost
short slot (J8) of a PC/XT by setting switch 58 ON (otherwise it should be OFF). This slot is
normally intended for driving the expansion chassis interface and has slightly different signals
from the other slots. If the DMA mode of operation is disabled, both DMA and interrupts will be
disabled and their settings will be meaningless.
There are 6 interrupt levels on the bus (2 thru 7). Interrupts are used for Direct Memory Access
@MA) data transfer only. With the exception of level 6 which is used by the floppy disk
adapter, most of the other . levels may be available. The MBC-488 is shipped with its DIP
switches set for a base I/O address of Hex 300, interrupt level 5, DMA level 1, and the J8 slot
feature disabled. These are usually good default values, and you may not need to alter them. If
you want to check them or change them before you install the board in your computer, insert the
software disk in your floppy drive and enter:

A> INSTALL

The INSTALL.EXB program is a self-explanatory program (INSTALL.EXB) that gives you a
pictorial view the correct switch settings on the MBC-488 for any combination of addresses,
interrupt level, DMA level etc. Simply set the switches the way you see them on the screen and
press &SC> to exit to DOS. You will also see warning messages for possible conflicting
addresses. If you receive a warning for a device that is not in your computer, it can safely be
ignored. These cautions apply strictly for IBM standard devices (although the same mapping is
followed by most compatibles) and may not be totally foolproof as far as non-IBM peripherals
are concerned. If your MBC-488 does not appear to work correctly, or interferes in some way
with other devices on your computer e.g. disk drives etc. or your computer will not boot up,
remove the MBC-488 and try a different I/O address, interrupt or DMA level. Once you have
set the base I/O address, make a note of its value as you will need to use it in the SYSCON
initializing command in your programs. All the other switch settings are read by the driver
(software) so you can forget the interrupt and DMA level settings. Prior to installing the
MBC-488 in your computer, SHUT OFF THE POWER and discharge any static electricity that
you may be carrying. The MBC-488 will fit in any of the regular full depth slots of the IBM
PC/XT/AT or the "half' slots of the IBM XT or Portable computer. You may feel some
resistance when pushing the IEEE-488 connector through the rear panel of your computer as the
slots are close to a clearance fit for this type of connector. The base of the connector plate has
been machined with a slight undercut, so once seated in the slot it should slide up and down
freely. When you mate a standard IEEE-488 cable to the connector, you may find it blocks
adjacent slot access to some extent due to its width. This can be avoided by placing the
MBC-488 in an end slot, or adjacent to a board that has no connector on it. If the connector
becomes a problem, MetraByte's IB-488 board avoids this difficulty through the use of a special
adapter cable. If you later remove the MBC-488 board, MetraByte recommends that you retain
the special electrostatically shielded packaging and use it for storage.



Backing up the DV488 Diskette
It is important to make a back-up copy of the software supplied with MBC-488. The software is
not copy protected so you may make as many copies as desired. It is supplied on a DOS 2.1 and
higher double sided (360K) floppy disk format.
DV.468 4
uCMBC-488 & the PSI2
The uCMBC-488 adheres to the design philosophy of the IBM PS/2 Programmable Option
Select (PCS) rules and, therefore, has no jumpers or switches. The uCMBC-488 has been
assigned a Board Identifier Number (BIN) of 5018 (hex) which is registered with IBM Corp.
Actual configuration of the uCMBC-488 board is done in software and requires a copy of the
IBM Reference Diskette and several files supplied by MetraByte. Prior to plugging the board
into the PS/2 expansion bus, you must install its BIN onto the reference disk (special ID numbers
may be obtained from MetraByte's Tech Support Dept. 508-880-3000). This will then be used
only once to install the system configuration onto battery backed RAM. The reference diskette
will not be used again unless you reconfigure your system. It should be stored in a safe place
after use. The uCMBC-488 has several static sensitive components so that caution should be
used when removing the board from it's shipping container.

1) Make a back-up copy of both the PSL? Reference Disk and the MetraByte uCMBC-488
Utility Disk. Now copy the @5018,ADF file from the MetraByte Utility disk onto the
copy of the PS/s Reference disk.

2) Shut OFF the power to the PS/2 and any option boards that are externally powered.
Remove the cover from the computer and install the board.

3) Place the copy of the IBM Reference Disk in drive A: and repower the computer.

4) After the computer runs it's power-up check, the error code 165 . .. Adapter Configura-
tion Error will appear, followed by two beeps.

5) After the IBM logo appears, press and after the first page of text.

6a) If you intend to use the default Base Address of 300 (HEX), you can automatically
configure your system by typing
6b) If you are not using the default Base Address for the uCMBC-488, type at the
prompt. This will return you to the Main Menu where you will select: 3. Set
Configuration. A Configuration Menu will appear. Select: 2. Change Configuration.
Use the cursor keys to through the configuration list until you see the MetraByte
uCMBC-488 in the appropriate expansion slot. Use the and keys to choose a
new Base Address. The press 7) You will not need the copy of the Reference Diskette again unless or until you
reconfigure your system. It should be stored in a safe place.
Modifying the @SOlti.ADF File

IBM's Configuration program has 16 possible choices for each selection. In the case of Base
Address, the uCMBC-488 supports 255 possible addresses. Use the GENADF.EXE file to
modify @501&ADF from 300 (HEX) to any other address you prefer. Be sure the file
(GENADF.EXE) is on the copy of the working (reference) diskette and then proceed as above to
change the configuration.


PS/2 Installation Errors

Several common errors may be encountered if you did not follow the above instructions
explicitly. They are:

Error Message Meaning Solution
165 Unrecognized Adapter Reconfigure the System.
Board
* Conflict Two or more adapter Select's new address for one of the
iz;z;sshare the same boards.

Set-up cannot find ap- .ADF file does not Copy .ADF to the working disk.
propriate .ADF file. appear on working
disk.
Set-up cannot read Unreadable .ADF file Use GENADF.EXE to recreate correct
.ADF file. on working disk. .ADF file.
DV-4SR 6
3.0 DEVICE DRIVER (DV488)
Introduction and General Overview

DV488 is the overall name given to MetraByte's (uC)MBC-488 device driver and example
routine software package. It is supplied free with the purchase of either the MBC-488 or the
uCMBC-488 GPIB interface boards. The software contains many example programs. The
examples illustrate serial and parallel data transfer in various formats including HIGH, LOW,
PACKED byte, and STRING data. Additionally, single/dual board configurations,
(uC)MBC-488 usage as talker/listener, and DMA/programmed data transfer modes are shown.
The examples are done in BASICA, C, FORTRAN, TurboPASCAL, and QuickBASIC. The two
Device Drivers are; DV488PC.SYS and DV488UC.SYS for the IBM PC/XT/AT and PS/2,
respectively. (See Appendix C for a complete file listing and brief description of each).


Installing DV488 Device Driver

Prior to operation of either the MBC-488 or uCMBC-488, the appropriate device driver
(DV488PC or DV488UC) must be installed. This is done by running DVSETUP.EXE (supplied
on your diskette). To run DVSETUP.EXE, type:

C:>DVSETUP

Once invoked, DVSETUP will prompt you for the (sub)directory containing DV488. Note that
VIPARSE.SYS must be in the same (sub)directory. CONFIG.SYS is a readable file. It should
look something like this.
BUFFERS = 20
FILES = 20
DEVICE = (path:)VIPARSE.SYS /HK=ALT H /MK=ALT M /SK=ALT TAB
DEVICE = @ath:)DV488PCSYS

If VLSYS was selected (for PCIP instruments, see Appendix C) as the device driver, add the
following line to CONFIG.SYS. It must be added before the line selecting VLSYS.

DEVICE = (path:)ANSLSYS

CONFIGSYS is automatically executed at system (computer) start-up and installs the various
device drivers required.




MetraByte's (uC)MBC-488 may be operated in one of two data transfer modes; a Programmed
Mode and a DMA mode. The Programmed mode requires that DMA and Interrupt levels be
disabled on the MBC-488 whereas the uCMBC-488 operates entirely via software so that
nothing need be done in order to operate in either mode.
A set of image specifiers are used in conjunction with the ENTER/OUTPUT commands to
format data prior to transfer to strings, integer variables, etc. These image specifiers also allow
the addition of parity to ASCII data and control characters & termination.
DIRECT MEMORY ACCESS (DMA) Mode of Operation

Both the MBC-488 and the uCMBC-488 in conjunction with the supplied device driver software
are capable of DMA data transfer at very high speed. Data transfer speeds on the order of
400Kbaud are possible on the Psi2 and similar increases are possible on the IBM PC/XT/AT.
This tremendous increase in transfer speed is possible by essentially bypassing the CPU,
program variables and other associated program overhead. The DMA mode of operation is
interrupt driven and it's ultimate transfer speed is subject to various interrelated factors, each of
which contributes to a final top end. Rarely, will actual data transfer speeds attain the maximum
possible. During DMA data transfer, data is dumped (or retrieved) directly to/from sequential
memory locations. Generally, the performance of the computer's DMA controller far exceeds
the ability of the device or instrument transferring data to/from the GPIB or the speed at which
the instrument is capable of collecting data. For a more detailed discussion concerning DMA,
see either chapter 5 (MBC-488) or Chapter 6 (uCMBC-488).

In order to implement DMA data transfers, remember that the (uC)MBC-488 must be configured
for interrupt implementation. See the hardware configuration section of this manual for a
complete discussion.




Regardless of the Mode of Operation (Programmed or DMA), the command sequence is the
same:

OUTPUT ENTER
1. UNTALK 1. UNTALK
2. UNLISTEN 2. UNLISTEN
3. Computer's TALK Address 3.Computer's LISTEN Address
4. Device LISTEN Address 4.Device TALK Address
(secondary address( (secondary address(
5. UNTALK

Once data transfer is complete, the bus is untalked if in control. When communicating with
devices using secondary addressing, the device's extended address is specified by separating the
primary address with a period (J.
When the computer is not the active controller on the bus, no other device may be addressed by
the computer (controller commands). However, the computer may transfer data as a talkerhis-
tener if configured as such by the controller. During an ENTER command, the computer waits
for the active talker on the bus to finish data transmission prior to it's transmission if it has been
addressed by the talker/listener. Address codes must be satisfied during GPIB activity or error(s)
will occur. DOS handles such errors, but often in a rather cryptic fashion. Most High and Low
level languages are capable of handling DOS errors allowing the user to perform WAIT loops or
write error handling routines thus allowing a high degree of debugging and increasing overall
program efficiency. The OUTPUT statement waits until the controller addresses the computer to
talk and the ENTER command waits until the controller addresses the computer to listen. The
computer may assume control if the controller in charge sends a Take Control Message after it
programs the computer as a talker. During DMA data transfer the computer waits until it is
addressed before transferring data. A driver "Device Time-out" error may occur if data is not
successfully transferred. The Time-out delay is adjustable using the TIMEOUT command.
4.0 GPIB PROGRAMMING with DV488

Programming and Device Driver Access

Data transfer operations to or from either the MBC-488 or the uCMBC-488 via the GPIB are
defined by a set of commands. The syntax or structure of these commands is critical. Each
element within a command must be separated by a single space and, normally, the first two
letters of a command must be capitalized. Trailing arguments are not case dependent (may be
upper or lower case). Since all data, whether transmitted or received, must be formatted prior to
GPIB activity these data must pass through the driver. This requires that the device driver be
accessed. For data transmission, the driver is "OPENed" for OUTPUT whereas data reception
requires the driver to be "OPENed" for INPUT as follows:

OPEN "$DV488UC" FOR OUTPUT AS #I
and/or

OPEN "fiDV488UC" FOR INPUT AS #K?

Once the driver has been accessed, data may be transmitted or received as follows:
To XMIT: PRINT #I, "OUTPUT 4 $ E +`I

where: 4 is the device #
$ is a String variable containing data
E is Even Parity
+ is addition of to the end of the data
and

To RCV: PRINT #l, "ENTER 4 $ +`I
INPUT #Z, DVMDT$


NOTE: The driver (DV488) provides for various errors (syntax, etc) that may occur. It does
not provide for error handling, however, since this is done via DOS (Disk Operating
System). DV488 errors may be accessed from the (uC)MBC-488 as shown in Chapter
4 (GPIB Programming with DV488). It is left to the user to assure that all required
conditions have been met prior to GPIB activity.
DV-488 9
Image Specifiers (Data Types) and Terminators

The image specifiers define data types as falling into two separate types with four categories.
These are listed below along with the specifiers for each:

STRING
count STRING with optional count (ENTER only)
B BYTE packed bytes of an integer array
RB BYTE packed bytes of an integer array in REVERSE Order
BL BYTE low byte of integer array (WORD)
BH BYTE high byte of integer array (WORD)

Image terminators are required for the devices on the GPIB to recognize the End Of Data
transfer. Each terminator acts somewhat differently so that you should be aware of the
subtleties. The image terminators operate the same way in all transfer modes. However, during
DMA transfers, the last data byte plus the image terminators, if requested, are sent via the system
CPU in order to clear the (DMA) interrupt for other computer operations (the interrupt service
routine handles this last byte plus terminators prior to returning to normal operation).

Programmed Terminator Sent Terminator Sensed
Terminator lOUTPUT command) a dl
% NONE =%Frnrn n
# EOI EOI
+ EOI and or EOI
! EOI or EOI
NONE EOI EOI


Command Structure & Syntax

Data transfer operations to/from the (uC)MBC-488 are defined by a set of commands. Case is
unimportant. For example:
en
&T or ent
ENTE ente
ENTER enter
Language peculiarities may require a detailed understanding of the particular language in order
to transfer data. However, the examples provided with the diskette should be adequate for the
majority of data I/O. For example, transferring an array (bytes) of data requires the segment,
offset and byte count. Since BASICA does not have a VARSEG statement, a driver semaphore
must precede the VARPTR (data segment) statement:

OUTPUT 12 B + &HFFFF varptr(A%(O)) 25

However, QuickBASIC supports the VARSEG statement:
OUTPUT 12 B + varseg(A%(O)) varptr(A%(O)) 25

In both cases, "A%" is the is the array containing the data to be transferred to device "12". The
data is in byte "B" format with "25" bytes being transferred.
DV.488 10
Device Driver Commands




FUNCTION

This argument is used to direct commands to the second board in the system. It is position
sensitive and must be used in the first position of the command line.
I




COMMAND USAGE
ABort PRINT #l, "ABORT"


II FUNCTION


i




COMMAND USAGE
BUfferclear OPEN #l "$DV488PC" FOR OUTPUT AS #l
PRINT #l, "BUFFERCLEAR"


FUNCTION

Used to CLEAR INPUT buffer of the computer prior to accepting data. Normally, it is used
immediately after OPENing the DV488 file for output. This is not a GPIB command.




COMMAND USAGE
CLear PRINT #l, "CLEAR 12 5"


FUNCTION

Used to clear up to 14 devices (6 secondary) to their power-up/default state. When used with
I device number, it clears only that device. If device numbers are not specified, all devices on
:he bus am cleared.
COMMAND USAGE
ENter PRINT #I, "ENTER 7 $"


FUNCTION

Used to receive data from the GPIB. As mentioned previously, there are five types of data tha
may be transferred.

STRING data "$,' Strings are often the most convenient format for simple data. String dan
is limited to about 4000 characters and is also the slowest method of data transfer. A coun
may be used with this format, but it cannot exceed 4000 bytes (default). Data transfer ends a
4000 bytes (or at specified count) or when a valid terminator or EOI is recognized.

Packed byte "B" Data is received and automatically packed into a one dimension integer
array (low byte first).

Reverse order "RB" Data is received into the type of array specified and packed in Reverse
Order statrting at the objetc's address plus the count. For single precision real array:
(variables), the count must be a multiple of four. Generally used for entering IEEE REAL
numbers that are sent by an instrument with the sign being sent first.
HIGH byte "BH" Data is received and placed into every second position (High Byte
position) of an integer array.

LOW byte "BL" Data is received and placed into every first position (Low Byte position) 01
an integer array.
DMA bytes "DMA High speed method of receiving data (up to 400 Kbytes/Sec). Data is
received in bytes and is packed into an integer array (low byte first).
NOTE: All byte format transfers will accept up to 64000 characters (bytes). A count is used
and data transmission ends when the specified count has been reached or when a valid
terminator or EOI has been recognized. Programmed terminators in byte format data transfers
may be a problem since hex D and hex A may be real data. Each device must be
specified if it is to receive data.




USAGE
PRINT #l, "LOCAL 3"


FUNCTION

Used to cancel the effect of REMote command (by turning off the remote line on the GPIB)
when no device(s) are given. If devices are specified, the remote line will not be turned OFF
and only the named device will return to local.
USAGE
PRINT #l, "LOCKOUT 5"


FUNCTION

Used to disable the front panel LOCAL function for devices supporting full RBMOTE/LO-
CAL operating modes. If the device is not in remote, LOCKOUT will cause the device to
enter the local state with lockout, disabling the local function while maintaining all other front
panel functions.
LOCKOUT sends the GPIB LLO message

Device address on the GPIB may be specified which will assert the REMOTE line and
nlace those devices in REMOTE with I.tX!KOl JT state.




COMMAND USAGE
OUTput PRINT #l "OUTPUT 7 S +`I, CMDS


FUNCTION

Used to transfer data to the bus. OUTPUT supports all five data format types.

STRING data "$" Strings are often the most convenient format for sending simple data 01
commands. String data is limited to about 4000 characters and is also the slowest method 01
data transfer. No count is used with this type of data format.

PACKED byte "B" Data is transmitted in bytes packed in integer arrays (low byte first).

HIGH byte "BH" Data is transmitted from every second position (High Byte position) of an
integer array only.

LOW byte "BL" Data is transmitted from every first position (Low Byte position) of an
integer array.

DMA bytes "DMA Highest speed method of transmitting data (up to 400 Kbytes/Sec). Data
is transmitted from bytes packed in a integer array (low byte first). The last byte and
terminators, if requested, are sent via normal I/O thru the system CPU. This is done in the
DMA interrupt service routine which then clears the interrupt line and returns the computer tc
normal operation.

NOTE: All byte format transmissions will send up to 64000 characters (bytes). A count is
used and data transmission ends when the specified count has been reached or when a valid
terminator or EOI has been recognized. Programmed terminators in byte format data transfers
may be a problem since hex D and hex A may be real data. Each device must be
specified if it is to transmit data.
COMMAND JJSAGE
PARpol PRINT #l, "PARPOL"
INPUT #2, STAT%


FUNCTION

IJsed to remrn Parallel Poll status hvt~efrom the GPTR. No device addresses are used.




PRINT!@&TL 7"


FUNCTION

Used to transfer control from the present controller to another device on the bus that is capable
of control functions. The command sends the TCT GPIB BUS message and waits for a
time-out period. A second PASCTL command will verify that control has been passed (error
#lO returned). Alternatively, the REQUEST command will return the status of the
(uC)MBC-488 board which contains the CIC status bit. If the bit is 0, the board has




COMMAND USAGE
PPConf PRINT #l, "PPCONP 12 PCONF=107"


FUNCTION

Allows the controller to program a device for a specific response to the parallel poll command.
The targeted device is programmed to respond to a specific GPIB line (DIO 1-8) and what it's
response should be (0 or 1). Only one device may be specified per PPCONF command.
Pl-P3 is the binary code for the GPIB line and S is the state of the response;

msb &
B7 B6 BS B4 B3 B2 Bl BO
x 1 1 0 s P3 P2 Pl
FUNCTION

Used to disable/clear device(s) for parallel poll response. If a device has been programmed for
a specific response to parallel poll, this command clears the device of its response. If no
devices address is given, it clears the entire bus of pre-programmed parallel poll configura-
tions.




COMMAND USAGE
REMote PRINT #l , "REMOTE 7"




Command used by the controller to establish a remote state so that the device(s) may be
controlled by a computer. Device(s) may be addressed or not. If device address are not
given, the GPIB asserts the REMOTE line. Once the REMOTE line has been asserted, any
device that is subsequently addressed will be set to remote status and remain in that state until
a LOCAL commandis sensed.




COMMAND USAGE
RXctl PRINT #l , "RXCTL"


FUNCTION

RXCTL may be used by a device expecting the GPIB controller to transfer control. The
command will cause a wait for the time-out period and return an integer indicating status of
the transfer (true if control was received, false if not received). No devices are specified.
FUNCTION

REQUEST is used to return the hardware status of the (uC)MBC-488 controller board. The
status is returned as an integer.


B13 B12 Bll BlO B9
SRQI x x LA TA DMA $A
BUSY ERR



COMMAND USAGE
REQuest 2 PRINT #1, "REQUEST 2"
INPUT #2, LEVELS%

FUNCTION

EQUEST 2 returns DMA & Interrupt levels
& Isb
B5 B4 B3 B2 Bl BO
DO D3 D2 Dl DO
DMA LEVEL
B15 B14 B13 B12 Bll BlO B9 B8
l/O l/O l/O l/O l/O l/O l/O l/O
EXTENDED SIGN

COMMAND USAGE
REQuest 1 PRINT #l, "REQUEST I", RESPONSE%


FUNCTION

REQUEST 1 is used to write a response pattern to the Serial Poll Register, This pattern is ther
output by the (uC)MBC-488 when it is serially polled by bus controller (this pattern is alsc
/called the Serial Poll Byte).

g
E? B6 B4 B3 B2 Bl
S8 rsv ifi s5 s4 s3 s2 Sl
When the rsv bit is 1, a service request is issued on the GPIB. The value of the others bits may
Ibe set by the user for whatever purpose is desired.
c
USAGE
PRINT#l, "SYSCON MADl=l2 CICl=l BAl=&H300 CLK=8"


FUNCTION




"MAD1 addresses, if desired.
"CICl cCIC29' Controller In Charge. There are four possible levels as follows:

"CICx=O" Addressed Talker/Listener. In this mode, the user's board is not in control and
must wait for the GPIB controller to address it as a Talker or Listener. The address used is the
one programmed by the MADx parameter. The REQUEST command is used to determine the
addressed state by testing the LA & TA bits. The user's program may switch between the LA
and TA modes at will.
"CICx=l" Controller In Charge. This command gives complete control of the GPIB to the


"CICx=2" Non-addressed Talker/Listener. Used to communicate with devices such as
printers, plotters, and other Talk Only/Listen Only devices not supporting GPIB addressing. If
the OUTPUT command is issued the driver will implement the TALK function and broadcast
on the GPIB disrupting any other GPIB traffic. If the ENTER command is issued the LISTEN
function is forced and the driver will accumulate data from the bus. Note that the user's
program may not arbitrarily switch between a TALKER and LISTENER mode without
reconfiguring the bus via the SYSCON command.

"BAl " Base Address. This command sets the (uC)MBC-488 base address in the
computer's I/O address space. It is left to the user to determine that the address assigned is a
valid address that does not interfere with other computer processes/devices. If two boards are
present, the driver only checks that they are 16-bytes apart. A test for the board at the given
address is also done.
PRINT #l, "STATUS 7"
INPUT #2, STAT%


FUNCTION




COMMAND USAGE
TIMEOUT A% = 100
PRINT #1 , "TIMBOUT", A%


FUNCTION

Used to set one time-out period for GPIB command and data transfer activity. An integer
multiplier is specified which sets the timeout period to a multiple of 56 milliseconds. If the
TIMBOUT command is never executed, the default timeout period is about 2 seconds. NC
devices are spr




USAGE
PRINT #l , "TRIGGER 7 12"


FUNCTION

Sends the GPIB "GET" message (Group Executive Trigger). The device(s) must have been
programmed to perform a specific task on GET or the message is ignored. One or more
devices must be soecified.
DV488 ERROR MESSAGES

All errors, whether BASICA or DV488, are handled by DOS. When a device driver error
occurs, the board sends three messages to the computer as mentioned above. These errors and
messages are listed below. Error numbers not listed are reserved.
ERROR # MESSAGE CAUSE


1 Unknown character encountered Misspelled DV488 command


2 Space expected ... Improperly spaced command elements.


3 DMA page wraparound An array address or byte count was passed for
DMA transfer that results in crossing a page
boundary. (See Section 5).


4 DMA level error Incorrect or disconnected DMA level.


6 DMA channel busy Bus request issued while DMA transfer in
progress.


8 Hardware Failure Error during internal procedure call or the IBC
chip encountered an error on a write.

9 Device time out If GPIB transfer failure occurred, driver retries
transfer for time out period.


10 GPIB BOARD not in control Issued command requires (uC)MBC-488 con-
trol.


11 GPIB BOARD is in control Issued command requires (uC)MBC-488 NOT
in control.

12 System not initialized SYSCON not issued prior to GPIB command.

13 Configuration Error One or more SYSCON parameters invalid. In
2 board systems, Base Addresses are not 16
bytes apart or the interrupt & DMA levels are
the same (IBM PC/XT) or the DMA levels arc
the same (PS/2). Board not found at specified
Address.
Undefined command Invalid or missing DV488 command.


15 Syntax error in command line Most often, missing spaces between command
parameters, misspelled commands or incom-
plete (missing) SYSCON parameters.


16 Undefined image Missing [$, B, RB, BL, BH, or DMA]

17 Device range error Invalid GPIB address. Must be between 0 -
30.


18 TOO many devices Specified command contained too many device
addresses.


20 Command /Data out of range Byte count passed must be between 1 - 65535.


21 Command requires device No address passed with GPIB command
requiring it.


24 GPIB BOARD must be talker or Normally occurs when CICx = 0 and the IBC
Listener chip has not been addressed. Use REQUEST
command to check address status in TA and
LA bits.




Programmed Data Transfer

In a normal or Programmed transfer, the data travelling to or from the 7210 controller passes
through the accumulator register (AX) of the computer's CPU. This allows flexibility in data
handling but also involves a good deal of CPU overhead (the CPU continually polls the 7210 for
new data which must be moved to/from the AX register and then move the AX register to/from
memory). This takes time and is dependent upon CPU speed. Even with this overhead, transfer
rates in programmed mode are usually around 1000-2000 bytes/second (also dependent upon
GPIB device response speed). Speed is usually not a major factor during instrument control
where command strings are generally short and response times long. But it may become a more
serious problem with devices that move a lot of data in blocks over the GPIB.
BASICA Example Program
The following is an example program, with comments, illustrating au MBC-488 board and a
typical device (Digital Multimeter with GPIB capability). It is written in BASICA as imple-
mented on the IBM PC/XT. It uses Serial Polling to ensure data validity. The program itself
(DVSPGL.BAS) is supplied on the diskette that came with your board, but this example is
exhaustively commented for new GPIB programmers.

100 ' IEEE488 Device Driver Example Program
110 ' BASICA
120 ' (DVSPGL.BAS)
130 ' Serial Poll with STRING data Transfer
140 ' MetraByte Corp l/17/89
150 '
160 '
170 CLS:KEYOFF:LOCATE 25,l:PRINT" Press any key to exit program";
180 LOCATE 1,l
190 '
200 ' This is an example of reading data from device 12, in this case
210 ' a Keithly 196 system DMM.
220 ' To run with a different device number, change command strings in
230 ' those lines referring to DEVICE 12.
240 '
250 ' ###t# Establish Communication with device driver #W#
260 '
270 OPEN "$DV488" FOR OUTPUT AS #l
280 PRINT #l, "BUFFERCLEAR"
290 OPEN "$DV488" FOR INPUT AS #2

Line 370 opens an output file (#l) for data transmission via $DV488.
Line 380 clears the output tile (buffer) of extraneous data, if any.
Line 390 opens an input file (#2) for receiving data via $DV488.
300 ON ERROR GOT0 1040

This is a simple error trapping routine for both BASICA and DV488 errors that may
occur during execution of the program.
310 '
320 ' ####Initialize MBC-488 board using SYSCON command.
330 '
340 PRINT#l, "SYSCON MADI= CICl=l BAl=&H300"

MAD1=3 assigns board #1 (MBC-488) a GPIB device address of 3.
CICl=l assigns board#l as controller in charge.
BAl=&H300 assigns board ##l a Base Address of 300 (hex).
Also transmits the GPIB message IFC (Interface Clear).
350 '
360 ' f##W Set GPIB device (DVM) into REMOTE state. #W##
370 '
380 PRINT #l , "REMOTE 12"
Set GPIB device at address #12 to remote state for computer control.
390 '
####Set Time-out period (timeout = 0.056 x A%) ####
:Yz '
420 A%=100
430 PRINT #l, "TIMEOUT", A%
440 '
450 ' #### Set Mode to TRIGGER on GET ####
460 '
470 CMD$ = "T3FOR3SOM8X"
480 PRINT #l, "OUTPUT 12 $ +" ,CMD$

The CMD$ is a DVM specific command for selecting various functions and ranges
on the DVM. Line 570 outputs this STRING (CMD$) command to device # 12 and
appends a , and asserts the EOI line with the a long time initial setup (5 seconds). A time delay loop such as the following is
common practice to avoid a bus lock-up.
490 '
500 LAP = 50 5 second delay for instr to process config data
510 INCREMENT = 0 1
520 TO = TIMER : D$=DATB$
530 Tl =:TO
540 WH ILE LAP <> 0
550 WHILE (Tl < (TO + INCREMENT))
560 Tl = TIMER : ID D$oDATE$ THEN Tl=T1+86400!
570 WEND
580 D$=DATE$:TO=TO+INCREMENT:IF TO>=86400! THEN TO=TO-86400!:
Tl=Tl-86400!
590 LAP = LAP - 1
600 WEND
610 '
620 #### Send TRIGGER message ####
630 '
640 PRINT #l, "TRIGGER 12"

Trigger Device #12 (DMM) for data measurements.
650 '
660 `###I@Wait for SRQ (Service Request) #f###
670
_. '
680 PRINT#l "REQUEST"
690 INPUT #2 : REQ%
700 PRINT "`J Jaiting for Service Request"
7 10 PRINT "R EQUEST word = &H";HEX$(SPOLL%):PRINT
720 IF (REQ% AND &H4000) <> &H4000 THEN 680
This is a status request that will return data in a long, signed integer format. The
information concerns various registers of the 7210 (IBC chip) as well as the
MBC-488 registers. No GPIB activity is initiated since the required data comes only
from the computer and board. The bit of interest is the SRQI bit in the 7210
~Interrupt Status Register 1. This bit is true when the GPIB SRQ line is asserted.
The SRQ line is a "WIRE OR" line meaning that one or more devices on the GPIB is
requesting service. This type of routine may be used as a "check for GPIB activity"
subroutine and may be entered and exited periodically to check for bus activity (data
transfers). However, the driver does not support interrnpt handling, as such, in this
1
condition.
730 '
740 ' ######ReadSerial Poll Byte ####
750 '
760 PRINT #l, "STATUS 12"
770 INPUT #2, SPOLL%
780 PRINT "Testina Serial Poll Bvte for `RSV"'
790 PRINT "Serial Foil Byte = &I?;HBX$(SPOLL%):PRINT
800 IF (SPOLL% AND 8) <> 8 THEN PRINT "No request in Serial Poll Byte":STOP

The Serial Poll (STATUS 12) is used to find out if device # 12 is the device
requested service since the SRQ line only indicates that one or more devices require
service. Data is returned in a long, signed integer. The contents of the DMM. serial
poll register are read back to the computer (via STRING variable SPOLL$) where it
is evaluated for activity (set high if true). The 8 is was used previously during the
DMM. setup (M8) enabling the DMM. to issue an SRQ under certain conditions.
810 '
820 ' ####Read data from device 12 @MM.) ####
830 '
840 PRINT #l, "ENTER 12$"
850 INPUT #2, DVM$
860 PRINT "DVM Data = ";
870 PRINT DVM$
880 PRINT:PRINT:PRINT

Line 810 instructs device 12 to transmit (TALK) STRING data.
Line 820 receives this data into the STRING variable DVM$.
Line 830 displays the received data on the computer display.
890 LAP = 20 `2 second delay for viewing data
900 INCREMENT = 0.1
910 TO = TIMBR : D$=DATB$
920 Tl=TO
930 WHILELAP<>
940 WHILE (Tl c (TO + INCREMENT))
950 Tl = TIMER : ID D$<>DATB$ THEN Tl=T1+86400!
960 WEND
970 D$=DATE$:TO=TO+INCRMENT:IP TO>=86400! THEN TO=TO-86400!:
Tl=Tl-86400!
;;; E.AF&LAP - 1


:i! KX$ = INKBY$:IP K$ = "" THEN 640
1020 CLOSE `close all files for I/O
1030 STOP `halt program
1040 IF ERR <> 68 AND (ERR<> 57) THEN PRINT "BASIC ERROR # ";ERR;" IN LINE
";ERL:STOP
1050 INPUT #2, E$
1060 PRINT "$DV488 driver returned error number - I', ES'
1070 INPUT #2, E$
1080 PRINT E$
1090 INPUT #2, E$
1100 PRINT E$
1110 END

Lines 890 thru 960 are simply checking for any error and returning these errors
whether BASIC errors or DV488 errors to STRING variable E$ for display.
Enhancing this routine could be done by branching to various other routines for
certain errors and correcting them.

Error #57 is a BASIC "Device I/O Error"

Error #68 is a BASIC "device unavailable" error indicating that $DV488 returned
the error. If this is the case, three strings are issued from the driver as follows:
1) Device Driver Error Number
2) Original Command String
3) Position (in command) where error occurred and plain english
error message.
NOTE: BASICA does not support long integers (32 bits), but the $DV488 driver returns a long
integer with only the low byte or word containing information. In all cases, the upper byte or
word is the extended sign. However, BASICA will correctly read the long signed integer
returned into a BASIC integer.
DMA Command Syntax

[BRD2] ENTER DEV DMA[term] SEGMENT OFFSET COUNT
[BRD2] OUTPUT DEV DMA[tenn] SEGMENT OFFSET COUNT

Example:
DMASEG% = &H8000 : DBFSEG = DMASEG%
PRINT #l. "ENTER 12 DMA +`I. DMASEG%. "0". "50'




Determining the Status of a DMA Operation

Once a DMA transfer has started, it will remain active until the terminal count is reached or a
valid EOI is received. DMA is really the hardware equivalent of an interrupt and is a
background operation. As such, your program may continue run in the foreground. Since this is
true, your program should be written to check DMA status. The status of a DMA operation can
be determined by the REQUEST command (see Commands). REQUEST returns a 16 bit
integer, bit 9 is set when the DMA is active and cleared when done. If required, a simple polling
loop (check bit 9) can be used to hold program execution until the DMA transfer is complete. If
any errors occur during the DMA last byte transfer, bit 8 of the REQUEST 1 return integer will
be set.
,QuickBASIC Example:
PRINT #l, "ENTER 12 DMA +`I, VARSEG(DMA%(O)), VARSEG(DMA%(O)), "50"


Transferring to a STRING%

S$ = SPACE$(1024) `allocate memory for 1024 characters
' calculate address offset of S$ in memory
offs% = (PEEK(VARPTR(S$) .t 2) + (256 * (PEEK(VARPTR(S$) + 3))))
PRINT #l, "ENTER 12 DMA +`I, VARSEG(S$), offs%, LEN(S$)
QuickBASIC Example Program

The following QuickBASIC example illustrates the use of DMA data transfer to/from a specific
memory address. It is also supplied on the diskette that was supplied with your uCMBC-488
under the file name QBDVDMA.BAS.

' =============================================
`QuickBASIC 4.0
`(QBDV2DMA.BAS)
`Serial Poll with DMA transfer on TWO Boards
`MetraByte Corporation


`This is au example of reading data from device 12, in this case
`a Keithly 196 system DMM.
`To run with a different device number, change command strings in
`lines referring to DEVICE 12.

DECLARE SUB ADDRESS (so/o,o%, count%, addr%, byteOff%)
CLSKEY 0FF:LOCATE 25,l: PRINT "Press any key to exit program";
LOCATE 1,l
`BOARD #1 array allocation
`Calculate address within DV%() that lies on a page boundary and
`return byte offset to that element

DIM dv%(200)
count% = LEN(dv%(O)) * 25 `allow 50 bytes for transfer
CALL ADDRESS(VARSEG(dv%(O)), VARPTR(dv%(O)), count%, addr%, byteOff%)

`calculate true beginning element for this array type
element% = byteOff% I LEN(dv%(O))
BOARD #2 array allocation
`Calculate address within DV2%() that lies on a page boundary and
`return byte offset to that element

DIM dv2%(200)
count% = LEN(dR%(O)) * 25 `allow 50 bytes for transfer
CALL ADDRESS(VARSEG(dv2%(0)), VARPTR(dv2%(0)), count%, addr2%, byteOff%)

`calculate true beginning element for this array type
element2% = byteOff% / LEN(dv2%(0))
`####Establish communication with device driver ##tW

OPEN "$DV488" FOR OUTPUT AS #l
PRINT #l, "BUFFERCLEAR"
OPEN "$DV488" FOR INPUT AS #2
ON ERROR GOT0 ersvc
DV-488 26

`Initialize uCMBC-488 board using "SYSCON"command

PRINT #l, "SYSCON MADI= CICl=l BAl=&H300 MAD2=3 CIC2=1 BA2=&H400"

`#### Set DMM into REMOTE #######

PRINT #l, `REMOTE 12"
PRINT ##l, "BRD2 REMOTE 12"

`#########SET TIMEOUT (timeout time = 0.056 x A%)
A%=100
PRINT #l, "TIMEOUT", A%
`####### SET MODE TO TRIGGER ON "GET"

DV$ = "T3R3M8X"

PRINT #l, "OUTPUT 12 $ +`I, dv$
PRINT #l, "BRD2 OUTPUT 12 $ +" dv$

LAP = 50 `wait 5 Seconds for set-up finish
TO = TIMER: D$=DATB$
Tl=TO
WHILE LAP <> 0
WHILE (Tl< (TO + INCREMENT))
Tl = TIMER : IF D$ <> DATES THEN Tl=Tl + 86400
WEND
D$=DATE$ : TO=TO + INCREMENT : IF TO>=86400 THEN TO=TO-86400:Tl=Tl-86400
LAP=LAP-1
WEND
`######## Send trigger message ##f####

WHILE M$ = ""
PRINT #l , "TRIGGER 12"

?#k+### Wait for SQR ###U###

REQ%=O
REQ2% = 0

WHILE (REQ% AND &H4000) <> &H4000
PRINT #l, "REQUEST"
INPUT #2, REQ%
PRINT "Waiting for Service Request from DVM on board #I"
PRINT "REQUEST WORD = &H"; HBX$(RBQ%):PRINT
WEND
DV-488
`######## Read Serial Poll byte ########
PRINT #l , "STATUS 12"
INPUT #2, SPOLL%
PRINT "Testing Serial Poll byte for `RSV"'
PRINT "Serial Poll Byte = &I-I"; HEX$(SPOLL%): PRINT
IF (SPOLL% AND 8) <> 8 THEN PRINT "No request in Serial Poll Byte": STOP

WHILE (REQ2% AND &H4000) <> &H4000
PRINT #I, "BRD2 REQUEST"
INPUT #2, REQ2%
PRINT "Waiting for Service Request from DVM on board #2"
PRINT `REQUEST word = &HI'; HEX$(REQ2%):PRINT
WEND

`#######Read Serial Poll byte ###G###

PRINT #l , "BRD2 STATUS 12"
INPUT #2, SPOLL2%
PRINT "Testing Serial Poll byte for `RSV"'
PRINT "Serial Poll Byte = &HI'; HEX$(SPOLL%): PRINT
IF (SPOLL2% AND 8) c> 8 THEN PRINT "No request in Serial Poll Byte #2": STOP

`########### Read data from DVM ###########

PRINT #l, "ENTER 12 DMA", addr%, "o", 16 ' start DMA on board #l
PRINT #l, "BRD2 ENTER 12 DMA", addr2%, "0". 16 ' board#2

`###I### Wait for DMA to finish ####I##
REQ% = &H200

WHILE (RBQ% AND &H200) <> &H200
PRINT #I, "REQUEST"
INPUT #2, REQ%
PRINT "Waiting for DMA ENTER to finish on board #l"
PRINT "REQUEST word = &H"; HEX$(REQ%):PRINT
WEND

PRINT "Data form DVM on board #l = ";
FOR offs = element% to element%+14 `recover stored DMA data
`print high byte then low byte of each integer

PRINT CHR$(dv%(offs)) AND &HFF); CHR$(dv%(offs) / 256);
NEXT offs
PRINT:PRINT:PRINT
`2 Second dealy for viewing



LAP <> 0
WHILE (Tl c TO+INCREMENT))
Tl=TIMER:IFD$<>DATE$THENTl=T1+86400

D$~k$:TO=TO+INCREMEN? IF TO>=86400 THEN TO=TO-86400:Tl=Tl-86400
LAP = LAP -1
WEND
PRINT
REQ2% = &H200

WHILE (REQ2% AND &H200) <> &H200
PRINT #l, "BRD2 REQUEST"
INPUT #2, REQ2%
PRINT "Waiting for DMA ENTER to finish on board #2"
PRINT "REQUEST word = &H";HEX$(REQ2%):PRINT
WEND
PRINT "Data form DVM on board #2 = ";
FOR offs = element2% to element2%+14 `recover stored DMA data
`print high byte then low byte of each integer

F'RIN;07p$(dv2%(offs)) AND &HFF); CHR$(dv2%(offs) / 256);

PRINT:PRINT:PRINT
LAP=20 `2 Second dealy for viewing
INCREMENT = 0.1
TO = TIMER:D$ = DATE$
Tl=TO
WHILE LAP <> 0
WHILE (Tl < TO+INCREMENT))
Tl = TIMER : IF D$ <> DATE$ THEN Tl = Tl + 86400
WEND
D$=DATE$:TO=TO+INCREMENT: IF TO>=86400 THEN TO=TO-864OO:Tl=Tl-86400
LAP = LAP - 1

z%

KX$ = INKEY$

WEND
CLOSE
STOP
ersvc:

IF (ERRo68) AND (ERRo57) THEN PRINT "BASIC ERR # ";ERR;" IN LINE ";
ERL:STOP
INPUT #2, E$
PRINT "$DV488 driver returned error number - "; E$
INPUT #2. ES
PRINT E$'
INPUT #2, E$
PRINT E$
END

SUB ADDRESS (so/o,0%. count%, addr%, byteOff%)

Subroutine to Allocate Space for DMA Transfers ,,.

DIM a AS LONG
DIM b AS LONG

s = s% `get segment address
o=o% `get segment offset
IFo IFscOTHENs=s+65536
a=s* 16+o
arrayptr = a `save org ptr for element talc
page = INT (a / 65536)

REM Check for DMA wraparound
b = a - (page * 65536)
b = b + count%
IF b > 65535 THEN
a = a (page = 1) * &HlOOO: `here if page wrap would occur
IF a > 32767 THEN addr% = a - 65536 ELSE addr% = a
ELSE REM here if no page wrap
a=a/16
IF a >32767 then addr% = a - 65536
IF a <= 3277 THEN addr% = a
ENDIF
IF addr% < 0 THEN c = addr% + 65536 ELSE c = addr%
c=c*16 ' new ptr to actual xfer element
`return byte offset where DMA will transfer in the named array

bytOff% = (c - arrayptr)
`note the byteOff% value must be divide by the length of the array type

END SUB
5.0 IBM PCIXT SPECIFIC PROGRAMMING STRUCTURE

DMA Data Transfer

The NEC 7210 controller on the MBC-488 is capable of performing transfers of data directly
from/to the GPIB to/from memory using direct memory access (DMA). In DMA mode, the
7210 generates a DMA request to the 8237 DMA controller on the IBM PC system board. In
turn, the DMA controller issues a hold request to the 8088 CPU which releases the internal PC
bus as soon as it completes its current instruction. The 8088 issues a hold acknowledge to the
DMA controller which then takes control of the bus, placing a valid memory address on the
address bus and issuing either a simultaneous memory read and I/O write (or memory write and
I/O read) together with a DMA acknowledge to the peripheral requesting transfer (MBC-488).
This enables transfer of data directly to/from the 7210 controller from/to memory. Depending
upon the interrupt level chosen, the data transfer process will continue until all data has been
transferred, as signaled by a valid EOI or the terminal count is reached. If, however, a higher
priority interrupt level requests service while (DMA) data is being transfered, the transfer is put
on hold until the higher priority request is serviced. Whereupon, data transfer resumes. For this
reason, the interrupt level should be chosen carefully so that it is assigned a priority level
corresponding to its overall system importance.

The installation of the MBC-488 DMA interrupt handler on IBM PC/XT class machines is
accomplished only once but no chaining mechanism is available (unlike the PS/2). The user is
cautioned not to use the DMA interrupt level for any other purpose (since a interrupt level
corresponds to a vector number which, in turn, points to an address in memory where the
handler resides). If the same level is used for another purpose, the DMA interrupt handler should
be reinstalled prior to MBC-488 requests for DMA data transfer.
The ultimate speed at which the DMA controller can handle DMA requests on a standard
4.77MHz IBM PC is about 400,000 bytes/second (it is faster still on an IBM PC/AT). In
practice, the actual transfer rate will depend upon the GPIB device(s) response speed. DMA
transfers are less flexible in passing data directly to variables and in general require more setup
than normal (programmed) transfers. However when speed is paramount, DMA is the best way
to use the controller.
IBM PC/XT Memory Page Boundary

The DMA controller is unable to transfer data across page boundaries. DV488 checks for page
boundary overlap. It is left to the user to ensure that memory has been allocated correctly for
data during DMA transfers.

There are sixteen legal pages within IBM PC memory so that it is unlikely that any array, unless
very large, will overlap a memory