Keithley KM-488-ROM User Manual

KM=4881ROM
Keithley Data Acquisition
KeitNey MetraByte/Asyst
FCC Class B Compliance
NOTE: This equipment has been tested
and
l
Reorient or relocate the receiving antenna.
l
Increase the separation between the equipment and receiver.
l
Connect the equipment into
an
outlet on a circuit different from that to which the receiver
is connected.
l
Consult the dealer or an experienced radio/tv technician for help.
NOTE:
The use of a non-shielded interface cable with the referenced device is prohibited.
User Guide
for the
KM-488-ROM
IEEE-488 Interface
Board
R~vislon A
- March $99,
Copyrlghl
Kelthley Data AC ulsltlon 1991
a Part Number: 244 9
KElTHLEY DATA ACQUISITION - Kelthley MetraSytelAsyst
440 Myles Standish Blvd., Taunton, MA 02790
TEL. 609/99%?0W. FAX MW990-0179
- 11, -
warranty Information
All products manufactured by Keithley Data Acquisition are warranted against defective materials and worksmanship for a period of one year from the date of delivery to the original purchaser. Any product that is found to be defective within the warranty period will, at the option of the manufacturer, be repaired or replaced. This warranty does not apply
to products damaged by improper use.
warning
Keithley Data Acquisition assumes no liability for damages
consequent to the use of this product. This product is not designed
with components of a level of reliability suitable for use in life
support or critical applications.
Disclaimer
Information furnished by Keithley Data Acquisition is believed to be accurate and reliable. However, Keithley Data Acquisition assumes no responsibility for the use of such information nor for any infringements of patents or other rights of third parties that may result from its use. No license is granted by implication or otherwise under any patent rights of Keithley Data Acquisition.
Copyright
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form by any means, electronic, mechanical, photoreproductive, recording, or otherwise without the express prior written permission of the Keithley Data Acquisition.
Note:
Keithley MetraByteW is a trademark of Keithley Instruments.
Basi? is a trademark of Dartmouth College.
IBM@ is a registered trademark of International Business Machines Corporation.
PC, XT, AT, PS/Z, and Micro Channel Architecture@ are trademarks of International Business Machines Corporation.
Microsoft@ is a registered trademark of Microsoft Corporation. Turbo C@ is a registered trademark of Borland International.
- iv -
Contents
CHAPTER 1
- INTRODUCTION
1.1
1.2
1.3
1.4
Overview
...................................
.1-l
Specifications
................................
1 1 1 1
.I-2
Ordering Information
.................................
. l-3
HowToUseThisManual..
.............................
.l-3
CHAPTER 2 - INSTALLATION
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.6
General
........................................
Unpacking & Inspecting
.2-i
Software Installation . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 . ’
. .2-l
.2-l
Switches 3 Jumpers
.............................
: : : : .2-2
Board Installation
...................................
Configuration Of The EEPROM
.2-7
Reloading The
EEPROM
........................
: : : : : : : : : : : : : : : :
.. .2-a
2-10
Multiple Board Installation Notes
...........................
2-10
CHAPTER 3 -
INTRODUCTION TO CALLABLE ROUTINES
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.6
3.9
Initializing The KM-486-ROM.
............................
.3-3
Selecting The Receive & Transmit Terminators Transmitting Commands&Data.
...........
: : : : : : : : : : : : : : : :
.. .3-3
.3-5
Reading Data
.....
...
..
Transmitting/Receiving Data Via
DMA
................. : : : : : : : : : : : : : : : :
3-11 3-14
Checking Device Status
..
3-15
Low-Level Routines.
...............................
.................................
3-17
Board Configuration
Routines
............................
3-16
Multiple Board Programming Notes
.........................
3-19
CHAPTER4 -
PROGRAMMING IN BASICA OR GWBASIC
4.1
4.2
4.3
General
........................................
.4-i
Description Format For Routines.
.4-3
Routines.
.
....
..
........................
: : : : : : : : : : : : : : : :
..
.4-3
CHAPTER 5 - PROGRAMMING IN QUICKBASIC
5.1
5.2
General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-i
5.3
Description Format For Routines. . . . . . . . . . . . . . . . . . .5-3
Routines. . . . . . . . . . . . . . . . . . . . . . . . . . . .5-3
CHAPTER 6 - PROGRAMMING IN TURBO PASCAL
6.1
6.2
6.3
General . . . . . . . . . , . . . , . . . . . . . . . . . . . . . . . . . . . .6-l
Description Format For Routines. . . . . .
Routines. . . . . . . . . . . . . . . . : : : : : : : : : : : : : : : : : ’
. .6-2
. .
6-3
Contents
CHAPTER 7 - PROGRAMMING IN C
7.1
General.
........................................
7-l
7.2
Description Format For Routines ...........................
7-3
7.3
Routines
........................................
7-3
CHAPTER6 - FACTORYRETURNS
APPENDICES
Appendix A - ASCII Code Chart Appendix B - IEEE Tutorial Appendix C - IEEE Multiline Commands Appendix D - Device Capability Codes Appendix E - Printer & Serial Port Redirection
n DD
- vi -
Chapter 1
INTRODUCTION
1.1 OVERVIEW
The KM4?8-ROM is an IEEE488 interface board that allows programs written on IBM PC/XT/ATs, IBM I’S2 25/3Os, or compatibles
to communicate
with an IEEE488 bus. This Board complies with the 1978 IEEE488 standard and is thus compatible with other IEEE488 products. Up to fourteen other devices may be connected to the IEEE488 bus, including instruments, printers, and other computers. The KM48-ROM
comprises a board,
software,
and documentation. Figure l-l is a block diagram of the KM-488-ROM board.
Figure l-l. KM-4&WROh4 Block Dlagram
The Kh4488-ROM design includes a Wait State Generator to adjust bus timing, allowing performance within operating specifications of the GLIB controller chip on the fastest PCs. This Board can also generate programmed interrupts on any of six interrupt request lines and DMA transfers on Channels 1,2, and 3. Selection of message terminators and timeouts is modifiable to allow communication with GPIB devices using non-standard characters and
timeouts.
INTRODUCTION 1 - 1
1.2
The KM-488-ROM also features an 8-KB EEPROM (Electrically Erasable Programmable Read Only Memory) containing firmware routines callable from a BASICA program. These routines perform the IEEE-488 transfer functions. KM-488ROM software libraries allow access to routines from programs in QuickBASIC, Microsoft C, and TURBO PASCAL. Examples for each language are included.
SPECIFICATIONS
Dimensions:
DMA Level:
Interrupt URQ) Capability:
Data Transfer Rate (Governed by the
slowest device):
IEEE Controller Chip:
Power Consumption:
Operating Temperature:
Storage Temperature:
Humidity:
Wait States:
Net Weight:
ROM Base Address:
I/O Base Address:
Device Interface Capabilities
Supported:
One Short PC Slot size. Channels 1,2,3, or None (Jumper Selectable). Levels 2 through 7 or None (Jumper Selectable).
> 300 Kb per second.
NEC7210.
< 500 mAmps.
0 to 50 T.
-4 to 158 ‘F (-20 to +70 “0. 0 to 90% noncondensing. 1,2,3, or 4 (Switch Selectable).
.31
lb (.14 kg). Switch Selectable. Switch Selectable. SHl, AHI, T5, TE5, L.3, LE3, SRl, RLl, PPl, PP2,
DCl, DTl, Cl-5, E1/2. (See Appendix D for clarification.)
1-2 KM-488~ROM USER GUIDE
1.3 ORDERING INFORMATION
PARTNUMBER
DESCRIPTION
KM-488-ROM Includes the KM-488-ROM IEEE-488 Interface Board,
Software (on 5.25” disks), and appropriate documentation.
KM-488-ROM/3.5 Includes the KM-488-ROM IEEE488 Interface Board,
Software (on 3.5” disks), and appropriate documentation.
CGPIB-I 1 meter IEEE-488 cable. CGPIB-2 2 meter IEEE-488 cable. CGPIB-4 4 meter IEEE-488 cable.
1.4 HOW TO USE THIS MANUAL
This manual provides the information necessary to install and program the KM-488-ROM. The manual assumes you are familiar with the language in which you are developing your application program; it also assumes you are familiar with the IEEE-488 protocol.
Chapter 2, Installation, details how to unpack, inspect, configure, and install the KM-488 ROM and how to copy the accompanying software. Additionally, Chapter 2 describes how to install the KM48EROM software and to configure the EEPROM and reload EEPROM
software. There are also notes on using multiple boards in one system.
Chapter 3, Zntroductfan fo the
CaRable Routines,
provides a brief functional description of each
KM488-ROM Interface Routine. Chapter 4, Programming the
KM-488-ROM,
provides a detailed description of each KM-488-
ROM Interface Routine and how it is called from each of the supported languages:
BASICA,
QuickBASIC, C, and TURBO PASCAL. Chapter 5, Factory Returns , gives instructions for returning the board to the factory. The appendices contain additional useful information. Appendix A contains an ASCII
Equivalence Chart. This gives hex and
decimal
equivalents for the ASCII 128 Character set. Appendix B is an IEEE-488 tutorial. Appendix C provides an explanation of the Device Capability Identification codes. Appendix D provides a cross-reference chart of IEEE Multiline Commands. Appendix E describes how to use the KM488-DD Printer Port Re­director.
INTRODUCTION 1 - 3
0
l-4 KM-488-ROM USER GUIDE
Chapter 2
INSTALLATION
2.1 GENERAL
Installation begins with procedures for unpacking and inspection followed by recommendations and instructions for software. Next is a section on switch and jumper
settings. Board installation is the next step, followed by EEPROM configuration.
2.2 UNPACKING 81 INSPECTING
After removing the wrapped Board from its outer shipping carton, proceed as follows:
1. Before unwrapping the Board, place one hand firmly on a bare-metal portion of the computer chassis to discharge static electricity from yourself and the Board (the computer must be turned Off but grounded).
2. Carefully remove the Board fromits anti-static wrapping material. You may wish to save the wrapping material for possible future use; if so, store it in a safe place.
3. Inspect the Board for signs of damage. If any damage is apparent, return the Board to the factory.
4. Check the remaining contents of your package against the packing list to be sure your order is complete. Report any missing items to the factory immediately.
5. When you are satisfied with preliminary inspection, you are ready to configure the Board. Refer to the next section for configuration options.
2.3 SOFTWARE INSTALLATION
Backing Up The Distribution Software
As soon as possible, make a back-up copy of your Distribution Software. With one (or more,as needed) formatted diskettes on hand, place your Distribution Sofhvare diskette in
your PC’s A Drive and log to that drive by typing A: . Then, make your backup using the
DOS
COPY
or
DISKCOPY
command, as described in your DOS reference manual
(DISKCOPY is preferred because it copies diskette identification, too).
installing The Distribution Software
Install the KM-488-ROM Distribution Software on your computer’s hard drive using the DOS COPY command.
INSTALLATION 2 - 1
NOTE: If you are using BASICA and the factory default settings, you may run the KM-
4%ROM board without installing any software. Instead, proceed to Section 2.4.
To install the software:
1. Turn on your PC and its display. You should see the standard DOS-level prompt. NOTE: If you install example programs written in multiple languages, you may want to
create a directory for each language. (This is the way the Distribution Software is organized.)
2. The following instructions create a directory named
KM488R. Type md \Rld488R
3. Change to the KM488Rdirectory by typing cd \KM488R
4. Place a KM-4&%ROM Diskette into the floppy drive (assume this is Drive a:) and type copy a:*.*
Repeat this step for each disk and/or subdirectory, until copying is complete.
Distribution Software Contents
Your Distribution Software contains the file
FILESDOC
, an ASCII text file readable with any
text editor or with the DO!?
TYPE
command. FlLES.DOC lists and briefly describes all files
in the Distribution Software.
The README.DOC File
To learn of last-minute changes, be sure to read the ASCII file
READMEDOC
2.4 SWITCHES & JUMPERS
Factory Settings
The KMG%-ROM contains three DIP switches and two jumper banks (see Figure 2-l). These switches and jumpers are factory-configured to work with most PC configurations. Table 2-l lists the factory selections.
Table 2-1. Factory Switch & Jumper Settlngs
SWITCH/JUMPER
FACTORY SE’ITING
I/O Base Address: 2b8h.
ROM Base Address: CCOOh ROM Enabled.
I/O Wait State:
1 Wait State; System Controller Enabled; EEPROM
Write Disabled.
Interrupt (IRQ) Level: Disabled.
DMA Level: Disabled.
2-2 KM-488~ROM USER GUIDE
For assistance with setting the switches or the jumpers, run the INSTALL program. This program illustrates the correct switch settings for your selections. To run the INSTALL program, make sure you are in the appropriate directory and type INSTALL at the DOS prompt. Then, follow program directions.
Figure 2-1. Switch and Jumper Locatlons
Switches
There are three DIP switch blocks on the KM48-ROM board, as follows: Wait State (Sl), I/O Base Address (S2), and ROM Base Address 63). The switches are factory-set to work with most PC configurations (see Table 2-l for settings).
NOTE: If you are using BASICA and change the I/O Base Address DIP switch settings, be
sure to run the configuration program, CONFIG. See Section 2.7.
I/O Base Address Switch
Setting an I/O Base Address enables the KM-488-ROM to communicate with the PC. You set an I/O Base Address for the Board by setting the seven positions of Switch S2 for the assigned address. Setting a switch position to ON puts the corresponding address line at a logic 0 (low).
The KM-488-ROM requires a series of 8 I/O port addresses that begin with the I/O Base Address. Therefore, be sure to select an I/O Base Address on an B-byte boundary that does not conflict with other devices in your computer (refer to your PC manual for the I/O address list to determine available spaces).
Figure 2-2 shows examples of I/O Base Address settings. Note that the factory-set Base Address is 288 hex; the I/O ports occupy the address range 288 - 2Bf Hex.
INSTALLATION
2-3
FIgore 2-2. Examples of l/O Base Address SeftlngS
ROM Base Address Switch
This switch determines whether the ROM memory is to be enabled and, if so, where within the first 1 MB of PC memory it is to be located. Enable the ROM if you are programming in BASICA. The ROM Base Address Switch 63) is an B-position DIP switch.
Seven of the S3 positions (1 - 7) to select the ROM Base Address. Position 8 enables/disables the ROM. Setting a position at ON puts the corresponding address line to a logic 0.
To enable or disable the ROM, set 53 Position 8 as shown in Figure 2-3. This position should be ON only if the KM-W-ROM is used with BASICA software.
Flgure 2-3. Enabllng the ROM ~%B,EO %&LED
Some alternative ROM Base Address switch settings are shown in Figure 2-1. The default
Base Address is CC00 hex. Be sure to select an 8 KB address space that is within the first 1 MB of PC memory and not occupied.
Flgure 2-4. ROM Base Address Selectlon
If you are
unsure
which address to assign to the EEPROM, use the MEMMAP program provided with the KM-488-ROM. This program scans your computer’s memory and determines what memory areas are available. To invoke the MEMMAI’ program, switch to the appropriate directory and type
m . Choose an unoccupied address space.
2-4 KM-488-ROM USER GUIDE
Wait State Switch
Switch 1 (Sll configures Wait States and the System Controller
ON = 0
Mode, and it enables Memory Write Protection. Sl is a 4-position DIP switch (see Figure 2-5). Setting a position to ON puts the corresponding address line at signal low (logical 01. Two positions (1 and 21 select the wait states.
Flgure 2-5. Welt State Switch.
Configure the System Controller function using Position 3 and the EEPROM protection using Position 4.
I/O Waif States
The KM-B&ROM design includes a switch-selectable wait-state generator. A selectable Wait State insures optimum performance and reliable operation at the differing bus clocks found in PCs. The default number of Wait States (11 should be correct for most PCs. vowever, if,youf data is garbled or your program crashes, you may need to adjust
the number of Wait States. Some general guidelines are presented in Table 2-2. Select the number of Wait States by setting Positions 1 and 2 (marked Wait State) on the DIP switch. You may program
‘03 911’1
, w*,, STATE , w*l, STITFS
the KM468-ROM to generate one, two, three, or four Wait States
during
I/O. Note that the number of memory Wait States is automatically set to a value which is one less than the I/O Wait States. To select a number other than the default, set the switches to one of the positions shown in Figure 2-6.
iE~Yg~
2 WNT sTME9 4 WIT STATES
Figure 2-6. t/O
Walt
State Seiectlons
Table 2-2. Welt States
BUS CLOCK FREQUENCY NUMBER OF WAIT STATES
<=5MHz
1 (default).
5MHz <ticq <8MHz
2.
8MHz <freq < 10MHz
3.
10 MHz < freq
4.
System Controller
This switch determines whether or not the KM488-ROM will act as a System Controller. If the KM-488-ROM is a System Controller, it has the ability to assert the IFC or REN lines.
Position 3 cm the Wait State DIP Switch determines whether
3 ON
the KM-438-ROM is acting as a Device/Controller or a System Controller. Valid selections are shown in Figure 2-7.
ON i
ON = 1
Figure 2-7. Device Mode Selection
II 1’
DEVICE OR SYSTEM CONTROLLER
CONTROLLER
INSTALLATION 2 - 5
Memory Write Enable
Positlone 4 on the Wait State DIP Switch enables or disables writes to the EEPROM on the KM488-ROM. Valid selections are shown in Figure 2-8.
Flgure2-8. EEPROM Enable Selection
EEPROM WR,TE
EEPROM WRITE
ENABLED
DlSABLED
This switch should normally be at DISABLE. It should be at ENABLED only when initializing or configuring the EEPROM BASICA support software.
Jumpers
The KM-ltlE-ROM contains two jumper blocks. These blocks select the Interrupt Level and
DMA Level.
Selecting an Interrupt Level
The KM-@&ROM is capable of interrupting the PC. The Interrupt Level (IRQ) Jumper (Jll defines the Interrupt Level. Valid Interrupt Level selections (2 through 7 and none) and the jumper positions are shown in Figure 2-9.
Figure 2-9. Interrupt Level (Ml) Jumpers
Selecting a DMA Level
DMA (Direct Memory Access) is a PC facility for speeding up data transfer from a peripheral to the computer. Select an appropriate DMA level using the DMA Level Jumpers. Refer to
2-6
KM-488-ROM USER GUIDE
Figure 2-10 for jumper positions.
F/gum 2-10. DMA Level Jumpers
2.5 BOARD INSTALLATION
To install the KM-488-ROM in a PC, proceed as follows:
1. Turn Off power to the PC and all attached equipment. WARNING!
ANY ATTEMPT TO INSERT OR REMOVE ANY ADAPTER BOARD WITH COMPUTER POWER ON COULD DAMAGE YOUR COMPUTER!
2. Remove the cover of the PC.
3. Choose an available option slot. Loosen and remove the retainer screw at the top of the blank adapter plate. Then slide the plate up and out to remove.
4. Before touching the Board, place one hand on any metallic part of the PC chassis (but not on any components) to discharge any static electricity from your body.
5. Make sure the Board switches have been properly set (refer to the configuration sections).
6. Align the Board connector with the desired accessory slot and with the corresponding rear-panel slot. Gently press the Board into the socket and secure with the retainer screw
for the rear-panel adapter-plate.
7. Replace the computer cover.
8. Plug in all cords and cables. Turn the power to the computer back on. You are now ready to make any necessary system connections.
INSTALLATION 2 - 7
If you are developing KM488-ROM application programs in C, TURBO PASCAL or QuickBASIC, the installation process is now complete. However, if you are developing programs in BASICA and have changed the factory default settings, you must to run the
EEI’ROM configuration program CONFIG.
2.6
CONFIGURATION OF THE EEPROM
When KM488-ROM application programs use BASICA, the programs read interface functions directly from the on-board EEPROM. Thus, the EEPROM must be properly configured, which may be accomplished using the CONFIG program. This program allows you to change such parameters of the EEPROM configuration as I/O Base Address, l/O Timeout, DMA Timeout, and Transmit/Receive Terminators.
Before changing the EEPROM configuration, you may want to read the descriptions of the DMA, RCV, and XMIT routines in Chapter 3. Also make sure that the ROM Base Address switch has the ROM Write function enabled. (See Section 2.4.)
Invoking The CONFIG Program
Invoke the CONFIG program as follows:
1. Install the Distribution Software (see Section 2.3) and the KM488-ROM board (see Section
2.5).
2. Switch to the appropriate directory. At the DOS prompt, type CONFIG
The PC monitor will show a screen labelled
K&-488-ROM CONFIGURATION. The
settings
will reflect any changes which were made by running the INSTALL program.
The following PC function keys are now active:
[E-II
[ml
[F31
I Shift II F3 I
[AltI[F31
[F81
HELP Invoke Help at any time by pressing [ Fl ] SHOW NEXT. In multiple board systems, pressing [ Fl I shows the
configuration of the next KM488-ROM. LOAD . Pressing this key loads the file KM488ROM.BlN to the EEPROM.
This function is useful when you want to load the factory defaults back into the KM488-ROM’s EEPROM.
LOAD NEW MEMORY. Pressing this key combination allows you to load the contents of the KM488-ROM’S EEPROM to a new segment of
DOS memory. The value you enter here must agree with the address selected by the ROM Base Address Switch. If you have trouble identifying
an unoccupied space, run the MEMMAP program (see Section 2.4). EDIT I/O ADDRESS. This key combination permits you to edit the I/O
Address field only. This
is
the address for access to the KM488-ROM. It
is important that you select an l/O Base Address on an S-byte boundary
that
does not conflict with other devices in your computer. The I/O Base
Address must fall within the range 200h to 3F8h. EDIT. This key allows editing of the configuration parameters (see the
next section for parameter descriptions). When editing is complete, press 1 MO 1. When the prompt Save changes to KM-488-ROM memory? Y/N appears, enter the appropriate response.
2-8 KM-488-ROM USER GUIDE
[ FlO I EXIT. Pressing this key exits the editing process. Otherwise, pressing
[ FlO I exits to the DOS prompt.
Once you have completed writing to the EEPROM, be sure to disable the EEPROM Write function (see Section 2.4).
NmEz Be sure to reset the EEPROM Write Switch when you complete writing to the
EEI’ROM. Many software programs are designed to search for free address space within the computer and may interpret the EEPROM as such.
Editing The Configuration Parameter Fields
Once you have invoked the EDIT function, you will be able to edit the configuration parameters. To exit from the EDIT function at any time, press I FlO
1.
To move between fields, use [ ? I and [ J I . Once you make your selection for a given parameter, press [ Enter 1 These parameters include the following:
DMA Timeout
I/O Timeout If the time elapsed between the transfer of individual bytes
exceeds the specified I/O Timeout period, an I/O Timeout Error will occur. This parameter sets the maximum amount of time (in milliseconds) which is to elapse. Enter a value between 0 and 65535 milliseconds for the I/O timeout. The default value is 10010 Ins.
A DMA Timeout Error is generated when the time to transfer (via DMA) an entire message exceeds the set DMA Timeout value. Valid entries for the DMA Timeout parameter are between 0 and 65535 milliseconds. ‘Ihe default value is 10010 Ins.
Transmit Terminators
Transmit Terminators (also referred to as Output Terminators) are appended to data sent from the KM-488-ROM to another IEEE-488 device. The terminators signal the end of the data transfer. The Transmit Terminator sequence consists of one or two ASCII characters with EOI optionally asserted, when the last terminator character is sent. Up to four different Transmit Terminator sequences may be selected.
To select a terminator sequence,
1. Referring to the ASCII Equivalence Chart in Appendix A, enter the HEX VALUE @Oh - FFh) of the first terminator byte. Press [ Enter I .
2. Repeat Step 1 for the second terminator byte. If a second terminator byte is not required, enter spaces. Press [ Enter ] .
3. Press 1 Space Bar 1 to enable EOI(EO1) or disable EOI (NOEOI). Press [ Enter I .
Repeat these three steps for each of the remaining Transmit Terminator Sequences.
The default Transmit Terminator Sequences are as follows: Terminator 0
LF EOI Terminator 1 CR LF EOI Terminator 2
CR EOI Terminator 3
LF CR EOI
INSTALLATION
2 - 9
Receive Terminators The KM488-ROM uses these items (also referred to as Input
Terminators.) to detect the end of a data transfer received from another device. The Receive Terminator sequence consists of one ASCII character with EOI optionally asserted. If the chosen
terminator character is detected in the incoming data, reception
will terminate. Note that any data byte received with EOI asserted will always terminate reception, regardless of the
selected terminator. Up to four different Receive Terminator sequences are available
for selection, as follows: Terminator 0
LF EOI
Terminator I
CR EOI
Terminator 2 , (comma) EOI
Terminator 3
; (semi-colon) EOI
To change the terminator character, use the procedure
previously outlined for Transmit Terminators.
2.7 RELOADING THE EEPROM
Under some conditions (for example, if the EEPROM contents have been destroyed), you will have to reload the EEPROM with the contents of the Kh4488ROM.BIN file. To perform this requirement, run the CONFIG program, as described in the previous section.
Before you reload the EEPROM, be sure its Write/Enable switch is enabled (see Section 2.4). The proceed as follows:
1. Invoke the CONFIG program. Switch to the appropriate directory and at the DOS prompt, type CONFIG.
2. Press [ F3 I.
When you completed the EEPROM reload, be sure to disable the EEPROM Write Enable switch (see Section 2.4).
2.8 MULTIPLE BOARD INSTALLATION NOTES
The KM-483-ROM software allows installation of up to four boards in a given system. Typically, situations with excessive cable lengths or more than 14 instruments require multiple boards.
When using multiple Kh4-488-ROMs, set the I/O Port Base Address to a different value on each of the boards. Routines within the software library allow you to determine which board to use by specifying the Base Address of the I/O port on that board.
When using BASICA, each board requires its own copy of software.
This means that you must select a different EEI’ROM memory address and I/O Base Address for each board. These Base Address ranges CANNOT overlap other address ranges within the system.
2-10
KM-4WROM USER GUIDE
Chapter 3
INTRODUCTION TO CALLABLE ROUTINES
To use the KM488-ROM within a custom data acquisition or control environment, you have to write software that will access the GPIB. The KM488-ROM includes a number of “callable” routines allowing this access from high-level languages such as BASIC, Quick BASIC, C, and TURBO PASCAL.
This chapter describes the callable-interface routines from a functional approach. Chapter 4
provides the exact syntax for calling the routine from BASIC, Quick BASIC, C, and TURBO PASCAL. Table 3-l provides an alphabetical listing of the available routines. The remainder of the chapter tracks the order of a routine’s usage and is organized as follows:
l
Initializing the KM488-ROM.
. Selecting the Receive and Transmit Message Terminators.
l
Transmitting Commands and Data.
l
Reading Data.
l
Transmitting/Receiving Data via DMA.
l
Checking the Status of a Device.
l
Low-level Routines.
l
Configuring the Board.
NOTE:
Explanations within this chapter assume you are familiar with IEEE486 communications. If you are new to IEEE488 or do not recognize some of the terminology used, refer to the IEEE488 Tutorial in Appendix B.
INTRODUCTION TO CALLABLE ROUTINES
3-1
Table 3-1. The Callable RoutlnSS
ROUTINE NAME
DESCRIPTION
GPIB OPERATIONS
DMA
DMATIMEOUT ’
ENTER
INIT
INTERM ’
IOTIMEOUT 1
OUTTERM ’
PPOLL
RCV
RCVA
SEND
SETBOARD 2
SETDMA 2
SETINT
SETPORT 2
SETSPOLL
SPOLL
SRQ 2
STATUS
XMIT
XMITA
Used to transmit/receive array data via DMA. (BASICA only) Sets maximum length of time for a DMA transfer. Addresses a device to talk and receives the talker’s data into a suillg. Initializes the KM-488-ROM.
Redefines input terminator settings. Sets the maximum length of time for an I/O transfer. Redefines output terminator settings. Performs a parallel poll.
Receives data into a string. Receives data into an array.
Addresses a specific device to listen and allows the current talker to send the data from a string.
Identifies, in a multiple board system, the board to be programmed. Allows use of DMA in conjunction
with XMITA and RCVA routines. Allows the KM-488~ROM interrupt enable bits to be set. Selects a non-default Base Address. Sets Serial Poll Response of the KM-488-ROM. Conducts a serial poll on a specified device.
Detects the state of tic SRQ signal on the bus.
Returns values of the various setup parameters.
Sends GPIB commands and data.
Transmits data from an array.
Asserts REN. Sends UNL, UNT, TALK adrs, MLA, data, UNJ-, LINT.
If KM-48%ROM is Sys. Contr.,
assert.9 IFC.
None.
None.
None.
Asserrs ATN and EOI and reads data byte.
Receives data. Receives data. Asserts RBN. Issues UNL, UNT, Listen Adrs, MTA, and sends data followed by a message terminator. None.
None. If RSV bit is set, will sssert SRQ.
Asserts REN. Issues UNL UNT, Talk adrs, SPE. Receives Serial Poll Response. Issues SPD. None.
Sends GPIB commands and data
as specified in string.
Sends data, optionally terminates
by EOI and/or terminator
characters
1 This routine is not supported in BASICA. To modify this parameter, use the
CONFIG program.
2 This call is not supported in BASICA. Its function, however, can be achieved
through different means.
3-2
KM-485ROM USER GUIDE
3.1 INITIALIZING THE KM-488-ROM
The first step in any KM488-ROM application program is to initialize the KM488-ROM board(s), using the lNIT routine.
3.2
INIT
This routine configures the KM4?8-ROM as a device or a controller. INIT also defines the Gl’IB address and determines whether Bus Handshaking is to be High or Low Speed. If INIT designates the KM-488-ROM as a System Controller, the Interface Clear (IF0 line on the GPIB
is asserted momentarily when INIT is called. Either High or Low Speed Handshaking is available. In High Speed mode, the KM-488~ROM
asserts the GPIB bus signal DAV approximately 500 ns after data is placed onto the bus. In the low speed mode, DAV is asserted about 2 microseconds after the data. In most cases, you will see no apparent differences in data throughput with Low Speed Handshaking. To maximize data throughput when using DMA, select High Speed Handshaking.
NOTE: Use the High Speed mode only in smaller installations, because High Speed
Handshake mode allows less time for data to settle. Thus, as cable lengths increase, the probability of transmission errors from cable reflections will increase.
NOTE: INIT must be the first KM-488-ROM routine called within the program.
lOTIMEOUT
This routine is not usable in BASICA. IOTIMEOUT allows you to reset the length of time that is to elapse before a Timeout Error occurs. A timeout Error occurs when the time between transmission and reception of adjacent bytes exceeds the set time. (I/O Timeout Error reports occur when using SEND, ENTER, XMITA, XMIT, and RCVA calls without DMAJ The default value of the timeout period is 10 seconds.
NOTE: The I/O Timeout may be changed at any point in the program.
SELECTING THE RECEIVE 81 TRANSMIT TERMINATORS
When data is transmitted to or from the KM-488-ROM, it may contain message terminator characters. These terminator characters are used to signal the end of data transmission.
Every KM-488-ROM routine that transmits or receives data contains a parameter allowing you
to define which of the default terminator sequences is to be used. If your application program is in C, QuickBASIC, or Turbo PASCAL, you may change the default terminator sequences by
calling the INTERM and OUTIERM routines. If you are programming in BASICA, you may change the default Transmit/Receive
Terminator sequences and the I/O Timeout period only by running the CONFIG program (see Sections 2.6 and 2.7).
INTRODUCTION TO CALLABLE ROUTINES
3 - 3
INTERM
This routine does not work in BASICA. INTERM allows you to change the values of each of
the four input message terminators. These terminators can be detected by the ENTER, RCV, and RCVA routines.
Each terminator sequence consists of one ASCII character (7-bit value). The default value for each terminator is shown below.
DECIMAL HEX
TERM # ASCII CHARACTER EQUIVALENT
EQUIVALENT
0
LF (Lime Feed) 10 OA 1 LF (Line Feed) 13 OD 2 , (comma) 44 2c 3 : (semi-colon) 59 3B
Note that if EOI is asserted withany data byte, data reception will be unconditionally terminated.
Instrument manufacturers frequently specify message terminators using ASCII representations. You may pass either the decimal or hexadecimal equivalents of the desired ASCII character into the INTERM routine. If using the hexadecimal value, be sure to use the correct prefix. This prefix is language-dependent. Check the language manual for more information.
OUTTERM
This routine does not work with BASICA. OUTTERM allows changes of values for each of the
four output message terminator sequences. You may append these terminators to the data sent by the SEND, XMIT, and XMITA routines to signal the end of message.
Each terminator sequence consists of one or two ASCII characters (irbit values) and may or may not assert EOI when the last terminator character is sent. The default values for each terminator appear in the following table.
ASCII CHARACTER DEC EQUIV
HEX EQUIV
TERM # IST ZND 1ST
2ND
1ST 2ND
EOI
0 LF 10 OA YES
1 CR LF 13 10 OD OA YES 2 CR 13 OD YES 3 LF CR 10 13 OA OD YES
Instrument manufacturers frequently specify message terminators using ASCII representations. You may pass either the decimal or hexadecimal equivalents of the desired ASCII character into the INTERM routine. For example, specify a Line Feed as OAh. If using the hexadecimal value, be certain to use the correct prefix; this prefix is language-dependent. Check the language manual for more information.
Terminators specified with this routine must be at least one character long. If you have an instrument or application requiring no terminator bytes (requiring assertion of EOI), use the XMIT or XMITA routine to transmit the data.
3-4
KM-488~ROM USER GUIDE
3.3
TRANSMllTlNG COMMANDS AND DATA
Once the GPIB system is initialized, the next step is usually to send commands and/or data to a device. Use any of the following routines to send:
l
SEND
l
XMIT
l
XMITA
l
IOTIMEOUT
SEND
Use this routine only when the KM488-ROM is an Active Controller.
SEND transfers string data from the KM488-ROM to the device specified by first addressing the KM488-ROM as a talker and the indicated device as a listener, and then asserting the REN line. Next, the command sends the string, followed by the selected message terminator, to the listener. The routine returns a status variable indicating whether or not the transfer is properly completed.
XMIT
The XMIT Routine allows the greatest amount of flexibility for sending GPIB commands (see Section 3.4.) and data. Data and commands to be sent over the GLIB are expressed in string form and then passed into the XMIT routine. All commands within the string may be UPPER or lower case; but they must be separated by one or more spaces.
If the KM488-ROM is acting as a Controller, the XMIT routine sends both commands and data. If executing the XMIT routine, the KM488-ROM must
l
Untalk and Unlisten all Devices.
l
Assign a Listener.
l
Address itself as a Talker.
If, however, the KM488-ROM is acting as a Device, the XMIT routine can only send data. In this instance, the KM488-ROM must be a talker before the XMIT routine can execute.
The XMIT routine will then parse the string and extract and send the commands over the bus in the specified sequence. The commands to carry out this sequence can all be within a single
string and handled by a single call to the XMIT routine.
The XMIT routine returns a single status variable to indicate the state of the data transfer. XMIT will report cases of invalid syntax, invalid address, undefined commands, timeout
errors, and attempts to send bus commands while not the active controller.
THE XMIT COMMANDS
Send these commands in the XMIT command’s info string; they consist of rudimentary GPIB and other commands and separate by function into three categories, as follows:
1. Data Transmission.
2. Polling.
3. Miscellaneous.
INTRODUCTION TO CALLABLE ROUTINES
3 - 5
DATA
END
EOI
GTL
Use this command after the KM-488-ROM has been addressed to talk. (If the KM-488-ROM is controller, issue an MTA. Otherwise, the Controller must address the KM-488-ROM. See the STATUS routine description for more information.) DATA sends the message that trails it to all previously addressed listeners.
Data may be in two forms. In one form, data is a string of ASCII characters that trails the DATA command. The ASCII string will be in single quotes (for example, ‘BYE’).
In the other form, data may be a string of numeric values, each of which ranges from 0 to 255. Each numeric value is the decimal equivalent of an ASCII character (see Appendix A for ASCII Equivalents). One or more spaces must separate each numeric entry. This form of entry is useful
where transmission of nonprintable characters is required. Note that you
may switch freely between the ASCII and Decimal representations after
the DATA command, as long as ASCII characters are in a string enclosed
by single quotes.
EXllmple
DATA ‘Eello’ 13 10 DATA
'Line
1’
13
10 ‘Line 2’ 13 10
If END follows the DATA command string, Message Terminator 0 signals the End of Transmission. Section 3.2 describes the default values of the transmit terminators and how to change them. Set the terminators to one or two bytes, and send them with or without EOI asserted on the last byte.
Example
DATA ‘Eello’ END If EOI (END OR IDENTIFY) follows the DATA command string, it
indicates that the character following EOI mnemonic will be sent with the
EOI line asserted.
Example
DATA ‘Hello’ 13 EOI 10
The GTL command forces bus devices addressed to listen to the Go To Local (front panel controllable) state, as opposed to controlled via Gl’lB. This command also onasserts the REN signal on the GPIB. Only the System Controller may use GTL. Note that this command DOES NOT allow you to selectively force only one device to Go To Local.
Note that it is more practical to use GTLA and LOC commands than GTL.
Example
GTL
3-6
KM-488~ROM USER GUIDE
GTLA Only a KM488-ROM acting as a System Controller may issue this
command. Use this command is used to send a Go To Local (GTL) Gl’lB command to those
devices
previously addressed to listen. This command
does not affect the state of the GPIB REN line.
Example
GTLA
LISTEN The KM488-ROM must be the Active Controller to execute this command.
This command addresses a given device(s) as a listener(s). LISTEN is trailed by the decimal GPIB address (0 to 30) of the device(s) to be addressed. When assigning multiple listeners, separate the addresses by one or more spaces.
Note that it is good practice to untalk and unlisten all devices prior to
sending a LISTEN command. (See the IJNT and IJNL descriptions.) Example LISTEN 2
LISTEN 5 9 30
LOC Use this command only if the KM488-ROM is acting as the System
Controller. When the LOC command is executed, it unasserts the GPIB RBN (Remote Enable) line. This action forces all devices on the GI’IB to the local state.
Example LOC
MLA The KM488-ROM must be the Active Controller to execute MLA (My
Listen Address). MLA forces the KM488-ROM to become a listener; it
sends a listen address co
mmand containing the GPIB address of the KM-
485ROM over the GPIB.
Example
b5A
MTA The KM-Q@-ROM must be the Active Controller to execute MTA (My Talk
Address). MTA makes the KM488-ROM the present talker (and onaddresses any other talker); it sends a talk address command containing the address of the KM488-ROM over the GPIB.
Example
MTA
REN This command can function only if the KM488-ROM is the System
Controller. The REN command asserts the REN (Remote Enable) Control
line on the IEEE-488 bus. Many devices require REN to be asserted before
they will accept commands or data.
Example
INTRODUCTION TO CALLABLE ROUTINES 3 - 7
3-8
SEC Use thls command in conjunction with TALK and LISTEN to specify a
secondary address. SEC must appear immediately after the primary address in a TALK or LISTEN command. The KM488-ROM must be an Active Controller to use SEC.
Example
TALK 3 SEC 5
LISTEN 4 SEC 8
TO If this command follows the DATA command, a Transmit Message
Terminator 0 will signal the end of data transmission. Section 3.2 describes the default values of the transmit terminators and how to change them. Set the terminators to one or two bytes, and send with or without EOI asserted on the last byte.
Example
DATA ‘Eello’ TO
Tl
If this command follows the DATA command, Transmit Message Terminator 1 will signal the end of data transmission. Section 3.2 describes the default values of the transmit terminators and how to change
them. Set the terminators to one or two bytes, and send with or without
EOI asserted on the last byte.
Example
DATA
‘Eello’ Tl
T2
If this command follows the DATA command, Transmit Message Terminator 2 will signal the end of data transmission. Section 3.2 describes the default values of the transmit terminators and how to change them. Set the terminators to one or two bytes, and send with or without EOI asserted on the last byte.
Example
DATA 'Eello' T2
T3 If this command follows the DATA command, Transmit Message
Terminator 3 will signal the end of data transmission. Section 3.2 describes the default values of the transmit terminators and how to change them. Set the terminators to one or two bytes, and send with or without EOI asserted on the last byte.
Example DATA 'Eello' T3
TALK The KM488-ROM must be the Active Controller to execute this command.
TALK designates the specified device as a Talker and is followed by the decimal GPIB address ( 0 to 30) of the device. Remember that only one device can talk at a given time; thus, if multiple TALK commands are in a
command string, only the last one takes effect. Note that it is good practice to untalk and u&ten all devices prior to sending a TALK command (see the UNT and UNL descriptions).
Example TALK1
TALK 22
KM-488.ROM USER GUIDE
UNT. The KM488-ROM must be the Active Controller to execute this command.
UNLISTEN unaddresses the present listeners, if any. Example DNL
UNT The KM488-ROM must be the Active Controller to execute this command.
UNTALK is used to unaddress the present talker, if any.
Example
UNT
POLLING COMMANDS
PPC
PPD
PPU
SPD
The Parallel Poll Configure (PPC) command signals a previously addressed listener that a Parallel Poll Enable @‘FE) byte or Parallel Poll
Disable (PI’D) command is to follow. Note that not all devices support parallel polling.
PPC is rudimentary GPIB command byte and is thus sent using the CMD command (see Miscellaneous Commands). The CMD command immediately follows the PPC command; for example,
PPC
c&m nnn
Where nnn is the decimal value of the Parallel Poll Enable byte. This byte has the following
format:
OllOSPPP
Where S is 0 or 1. The addressed device will set the designated GPIB data line (determined by PPP) to the given value if service is required.
PPP
is a 3-bit value which represents a GI’IB data line (0 - 7). The
configured device will use this data line to respond to a parallel poll. Eurmple UNL LISTEN 6
MTA
PPC CbfD 101
The PPD (Parallel Poll Disable) command disables parallel poll response of any previously addressed listeners. PPD must always immediately
follow a PPC. Example
DNL LISTEN 12
MTA
PPC PPD
The I’I’U (Parallel Poll Unconfigure) command disables the parallel poll response of all devices on the bus.
Example PPV
The Serial Poll Disable (SPD) command returns the currently addressed
talker from the serial poll state to the “normal” talker state. Example SPD
INTRODUCTION TO CALLABLE ROUTINES 3 - 9
SPE The Serial Poll Enable (WE) command forces a device, previously
addressed to talk, to send its serial poll response instead of its normal data.
Example
UNL UNT b&A TALK 20 SPE
MISCELLANEOUS COMMANDS
CMD CMD indicates the next byte is to be sent as a GPIB command. A GPIB
command is any data byte sent in conjunction with the ATN control line asserted on the bus. The byte is must be specified in decimal format (range 0 to 255) and must follow the CMD mnemonic within the XMIT command string.
Example
PPC
CMD 96
DCL The Device Clear command forces all devices attached to the GPIB
(addressed or not) to a predefined state. The actual response of a device to this command is device-dependent.
Example
DCL
GET The GET (Group Execute Trigger) command synchronizes the start of a
devicedependent operation in all previously addressed listeners. In many devices, GET allows the KM488-ROM to trigger a measurement. This function is not supported by all devices.
Example
LISTEN 12 GET
IFC This command can only be issued by a KM-488-ROM which is the System
Controller. The IFC (Interface clear) command resets the interface state of all devices which are tied to the GPIB. It unaddresses all devices and forces the System Controller to become the Active Controller (if control had been passed to another device).
Example
IFC
LLO The LLO (Local Lockout) command allows you to disable the front panel
control of all devices that support this command. In many cases, this command works in conjunction with the GPIB REN signal. Local control may be restored with the GTLA or LOC commands.
Example
LLO
3-10
KM-488~ROM USER GUIDE
Loading...
+ 164 hidden pages