The information contained in this manual is believed to be accurate and reliable. However, Keithley
Instruments, Inc., assumes no responsibility for its use or 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 Instruments, Inc.
KEITHLEY INSTRUMENTS, INC., SHALL NO T BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES RELATED 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.
Refer to your Keithley Instruments license agreement for specific warranty and liability information.
MetraByte is a trademark of Keithley Instruments, Inc. All other brand and product names are
trademarks or registered trademarks of their respective companies.
All rights reserved. Reproduction or adaptation of any part of this documentation beyond that permitted
by Section 117 of the 1976 United States Copyright Act without permission of the Copyright owner is
unlawful.
Keithley MetraByte Division
Keithley Instruments, Inc.
440 Myles Standish Blvd. Taunton, MA 02780
FAX: (508) 880-0179
Telephone: (508) 880-3000
●
Preface
This manual describes how to write application programs using the
DASDLL Function Call Driver. The DASDLL Function Call Driver
supports the following Windows -based languages:
●
Microsoft Visual C++ (Version 1.0 and higher)
Microsoft Visual Basic for Windows (Version 3.0 and higher)
●
The manual is intended for application programmers using one of the
following boards in an IBM
DAS-8 Series
●
●
DAS-16 Series
●
DAS-20
●
DAS-40 Series
DAS-HRES
●
DDA-06
●
●
Series 500
●
PIO Series
PDMA Series
●
PC AT
or compatible computer:
Throughout this manual, these boards are referred to as DASDLLsupported boards.
It is assumed that users
●
have read the External DAS Driver user’s guide and the user’s guide
for their particular board to familiarize themselves with the board’s
features.
ix
have completed the appropriate hardware installation and
●
configuration.
●
are experienced in programming in their selected language and are
familiar with data acquisition principles.
The DASDLL Function Call Driver User’s Guide is organized as follows:
Chapter 1 provides an overview of the Function Call Driver and
●
describes the installation procedure. Information is included on
setting up the board and how to get help, if necessary.
Chapter 2 describes the available operations and contains the
●
background information needed to use the functions included in the
Function Call Driver.
Chapter 3 contains programming guidelines and language-specific
●
information related to using the Function Call Driver.
Chapter 4 contains detailed descriptions of the functions and their
●
usage, arranged in alphabetical order.
Appendix A contains a list of the error codes returned by the Function
●
Call Driver, along with specific causes and suggested solutions.
●
Appendix B contains instructions for converting counts to v oltage and
for converting voltage to counts.
Appendix C provides board-specific operating specifications on gains
●
and channels.
●
Appendix D includes instructions for installing the Keithley Memory
Manager.
An index completes this manual.
Note:
The DASDLL-supported boards vary in their features and
operating parameters. Information presented in this manual is generic to
cover ev ery board’ s requirements. F or board-specific information, refer to
your board’s user’s guide and External DAS Driver user’s guide. Your
board’s user’s guide is shipped with your board; the External DAS Driver
user’s guide is shipped with the DASDLL software package.
The DASDLL Function Call Driver is a library of data acquisition and
control functions (referred to as the Function Call Driver or FCD
functions). Table 1-1 lists the Keithley DAS boards supported by the
DASDLL Function Call Driver.
PIO PIO-12, PIO-24, PIO-32, PIO-96, PIO-HV
PDMA PDMA-16, PDMA-32
Throughout this manual, the boards in Table 1-1 are referred to as
DASDLL-supported boards.
DDA-06
AIM7, AIM8, AIM9
1-1
The DASDLL software package contains the following:
Dynamic Link Libraries (DLLs) of FCD functions for Microsoft
●
Visual C++ and Microsoft Visual Basic for Windows.
●
Support files, containing program elements, such as function
prototypes and definitions of variable types, that are required by the
FCD functions.
●
Language-specific example programs.
The following sections describe how to install the software, how to set up
a board to use the DASDLL Function Call Driver, and how to get help, if
necessary.
Installing the Software
To install the DASDLL software package, perform the following steps:
1. Make a backup copy of the supplied disks. Use the copies as your
working disks and store the originals as backup disks.
2. Insert disk #1 into the disk drive.
3. Start Windows, if necessary.
4. From the Program Manager menu, choose File and then choose Run.
5. Assuming that you are using disk drive A, type the following at the
command line in the Run dialog box, and then select OK:
A:SETUP
The installation program prompts you for your installation
preferences, including the drive and directory you want to copy the
software to. It also prompts you to insert additional disks, as
necessary.
1-2Getting Started
6. Continue to insert disks and respond to prompts, as appropriate.
When the installation program prompts you for a drive designation,
enter a designation of your choosing or accept the default drive C.
When the installation program prompts you for a directory name,
enter a name of your choosing or accept the default name.
The installation program creates a directory on the specified drive and
copies all files, expanding any compressed files.
The installation program also creates a DASDLL family group; this
group includes example Windows programs.
7. When the installation program notifies you that the installation is
complete, review the following files:
–FILES.TXT lists and describes all the files copied to the hard disk
by the installation program.
–README.TXT contains information that was not available when
this manual was printed.
Setting Up the Board and the Driver
Before you use the DASDLL Function Call Dri v er, you must perform the
following tasks:
1. Set up your board’s hardware. Refer to your board’s user’s guide and
your External DAS Driver user’s guide for information.
2. Exit Windows and return to DOS.
3. Run the configuration program for your board from DOS. The
configuration program is shipped with the External DAS Driver for
your board. Refer to your External DAS Driver user’s guide for
information.
Note:
You cannot run the configuration program or load the External
DAS Driver from the MS-DOS Prompt when in Windows. You must
exit Windows and return to DOS.
1-3
4. Load the External DAS Driver for your board from DOS. Refer to
your External DAS Driver user’s guide for information.
5. Load Windo ws.
Getting Help
Note:
If you want to set up your AUTOEXEC.BAT file to
automatically load the External DAS Driver, make sure that you
include the line that loads the External DAS Driver before the line
that loads Windows.
If you need help installing or using the DASDLL Function Call Driver,
call your local sales office or the Keithley MetraByte Applications
Engineering Department at:
(508) 880-3000
Monday - Friday, 8:00
A.M.
- 6:00
, Eastern Time
P.M.
An applications engineer will help you diagnose and resolve your
problem over the telephone.
1-4Getting Started
Please make sure that you have the follo wing information av ailable before
you call:
DASDLL-supported
board configuration
Computer
Operating system
Software package
Compiler
(if applicable)
Model
Serial #
Revision code
Base address setting
Interrupt level setting
Input configuration
Input range type
DMA channel
Other
Manufacturer
CPU type
Clock speed (MHz)
Amount of RAM
Video system
BIOS type
This chapter contains the background information you need to use the
FCD functions to perform operations on DASDLL-supported boards. The
supported operations are listed in Table 2-1.
Table 2-1. Supported Operations
OperationPage Reference
Systempage 2-2
Analog inputpage 2-6
Analog outputpage 2-17
Digital input and output (I/O)page 2-25
Note:
operating parameters. Information presented in this chapter is generic to
cover ev ery board’ s requirements. F or board-specific information, refer to
your board’s user’s guide and External DAS Driver user’s guide. Your
board’s user’s guide is shipped with your board; the External DAS Driver
user’s guide is shipped with the DASDLL software package.
The DASDLL-supported boards vary in their features and
2-1
The following features are not supported by the DASDLL Function Call
Driver, even though the External DAS Driver for your DASDLL may
support them:
Timed interrupt functions
Time of Day (TOD) functions
●
System Operations
This section describes the miscellaneous and general maintenance
operations that apply to DASDLL-supported boards and to the DASDLL
Function Call Driver. It includes information on the following operations:
Initializing the driver
●
Initializing a board
●
Retrieving revision levels
●
●
Handling errors
Initializing the Driver
You must initialize the DASDLL Function Call Driver and any other
Keithley DAS Function Call Drivers you are using in your application
program. To initialize the drivers, use the K_OpenDriver function. You
specify the driver you are using; the driver returns a unique identifier for
the driver (this identifier is called the driver handle).
If a particular driver is no longer required and you want to free some
memory , you can use the K_CloseDriver function to free a driver handle
and close the associated driver. The driver is shut down and the DLLs
associated with the driver are shut down and unloaded from memory.
2-2Available Operations
Note:
driver and determine the number of boards found by the DASDLL
Function Call Driver.
Initializing a Board
The number of boards supported by the DASDLL Function Call Driver
depends on the number of External DAS Drivers you loaded and the
number of boards supported by each External DAS Driver. You must use
the K_GetDevHandle function to specify the boards you want to use.
The driver returns a unique identifier for each board; this identifier is
called the board handle.
You can also use the DASDLL_DevOpen function to initialize the
Board handles allow you to communicate with more than one board. You
use the board handle returned by K_GetDevHandle in subsequent
function calls related to the board.
You can specify a maximum of 30 board handles for all the Keithley
MetraByte boards accessed from your application program. If a board is
no longer being used and you want to free some memory or if you have
used all 30 board handles, you can use the K_FreeDevHandle function to
free a board handle.
Note:
You can also use the DASDLL_GetDevHandle function to
specify the boards you are using.
The board number you specify in K_GetDevHandle is a logical board
number; it is determined by how you loaded your External DAS Drivers.
For example, Figure 2-1 illustrates a system in which you first loaded the
DAS-8 External DAS Driver (configured for two boards) and then loaded
the DAS-16 External DAS Driver (configured for two boards).
2-3
DAS-8 External DAS Driver
Note:
Board 1
Board 2
DAS-16 External DAS Driver
Board 1
Board 2
Figure 2-1. Logical Board Numbers
The DASDLL Function Call Driver treats Series 500 modules as
Logical Board Number = 0
Logical Board Number = 1
Logical Board Number = 2
Logical Board Number = 3
separate boards.
You can use the DASDLL_GetBoardName function to return
information about the boards and drivers loaded in your system. When
you enter a logical board number, the dri ver returns the name of the dri ver
associated with the board. A NULL pointer is returned if no driver is
associated with the board.
For example, if you set up a loop to return the names of the drivers
associated with the boards shown in Figure 2-1, the driver returns four
strings and a NULL pointer. The first two strings represent the DAS-8
External DAS Dri v er; the ne xt two strings represent the DAS-16 External
DAS Driver; the fifth string is a NULL pointer.
The returned strings indicate that your system contains four boards. The
first two logical boards, 0 and 1, are DAS-8 Series boards; the next two,
boards 2 and 3, are DAS-16 Series boards.
2-4Available Operations
To reinitialize a board during an operation, use the K_DASDevInit
function. K_GetDevHandle , DASDLL_GetDevHandle , and
K_DASDevInit perform the following tasks:
Abort all operations currently in progress that are associated with the
●
board identified by the board handle.
●
Verify that the board identified by the board handle is the board
specified in the configuration file.
Retrieving Revision Levels
If you are having problems with your application program, you may want
to verify which versions of the Function Call Driv er , Keithle y D AS Driv er
Specification, and Keithley DAS Shell are used by your board.
The K_GetVer function allows you to get both the revision number of the
Function Call Driver and the re vision number of the K eithley DAS Driver
Specification to which the driver conforms.
The K_GetShellVer function allows you to get the revision number of
the Keithley DAS Shell (the Keithley DAS Shell is a group of functions
that is shared by all DASDLL-supported boards).
Handling Errors
Each FCD function returns a code indicating the status of the function. To
ensure that your application program runs successfully, it is
recommended that you check the returned code after the execution of
each function. If the status code equals 0, the function executed
successfully and your program can proceed. If the status code does not
equal 0, an error occurred; ensure that your application program takes the
appropriate action. Refer to Appendix A for a complete list of error codes.
Each supported programming language uses a different procedure for
error checking. Refer to the following for information:
Visual C++page 3-33
Visual Basic for Windowspage 3-37
2-5
For Visual C++ only, the Function Call Driver provides the
K_GetErrMsg function, which gets the address of the string
corresponding to an error code.
Analog Input Operations
This section describes the following:
Analog input operation modes available.
●
●
How to allocate and manage memory for analog input operations.
●
How to specify the following for an analog input operation:
–Channels and gains
Note:
operating parameters. For board-specific information, such as voltage
input ranges, refer to your board’s user’s guide and External DAS Driver
user’s guide.
Operation Modes
The operation mode determines which attributes you can specify for an
analog input operation and how data is transferred from the board to
computer memory . You can perform analog input operations in one of the
following modes:
The DASDLL-supported boards vary in their features and
Single mode - In single mode, the board acquires a single sample
from an analog input channel. The driver initiates the conversion; you
cannot perform any other operation until the single-mode operation is
complete.
2-6Available Operations
Use the K_ADRead function to start an analog input operation in
single mode. You specify the board you want to use, the analog input
channel, the gain at which you want to read the signal, and the
variable in which to store the converted data.
Synchronous mode - In synchronous mode, the board acquires a
●
single sample or multiple samples from one or more analog input
channels. A hardware pacer clock initiates conversions. You cannot
perform any other operation until the synchronous-mode operation is
complete. After the driver transfers the specified number of samples
to the host, the driver returns control to the application program,
which reads the data.
Use the K_SyncStart function to start an analog input operation in
synchronous mode.
Interrupt mode - In interrupt mode, the board acquires a single
●
sample or multiple samples from one or more analog input channels.
A hardware clock initiates conversions. Once the analog input
operation begins, control returns to your application program.
Use the K_IntStart function to start an analog input operation in
interrupt mode.
You can specify either single-cycle or continuous buffering mode for
interrupt-mode operations. Refer to page 2-14 for more information
on buffering modes. Use the K_IntStop function to stop a
continuous-mode interrupt operation. Use the K_IntStatus function
to determine the current status of an interrupt operation.
●
DMA mode - In DMA mode, the board acquires a single sample or
multiple samples from one or more analog input channels. A
hardware clock initiates conv ersions. Once the analog input operation
begins, control returns to your application program. DMA mode
provides the fastest data transfer rates.
Use the K_DMAStart function to start an analog input operation in
DMA mode.
You can specify either single-cycle or continuous buffering mode for
DMA-mode operations. Refer to page 2-14 for more information on
buffering modes. Use the K_DMAStop function to stop a
continuous-mode DMA operation. Use the K_DMAStatus function
to determine the current status of a DMA operation.
2-7
The converted data is stored as counts. For information on converting
counts to voltage, refer to Appendix B.
Memory Allocation and Management
Interrupt-mode and DMA-mode analog input operations use one or two
memory buffers to store acquired data; synchronous-mode analog input
operations use one memory buffer to store acquired data. (You can use
two memory buffers if your External DAS Driver supports double
buffering; the dri ver automatically switches from the primary b uffer to the
secondary buffer when the primary buffer is full.)
Note:
Except for DASDLL-40 Series boards, it is recommended that you
always use a single memory buffer, particularly for analog input
operations faster than 1 kHz.
Use one of the following functions to allocate memory:
●
K_SyncAlloc for synchronous-mode or interrupt-mode operations.
●
DASDLL_DMAAlloc for DMA-mode operations.
You specify the following:
●
Operation requiring the memory buffer.
Number of samples to store in the memory buffer (up to 32,767).
●
The driver returns the starting address of the memory buffer and a unique
identifier for the buffer (this identifier is called the memory handle).
When the memory buffer is no longer required, you can free the b uffer for
another use by specifying the memory handle in one of the following
functions:
K_SyncFree for synchronous-mode or interrupt-mode operations.
●
●
DASDLL_DMAFree for DMA-mode operations.
2-8Available Operations
If you are using two memory buffers, you can w ork on data in the inactiv e
buffer while the active buffer continues to collect data. To determine the
active buffer, use the K_IntStatus function (for interrupt mode) or the
K_DMAStatus function (for DMA mode). Depending on the speed of
your operation and the particular board you are using, data may be lost
when the driver switches from one memory buffer to the other. To
determine whether any data has been lost, use the K_IntStatus function
(for interrupt mode) or the K_DMAStatus function (for DMA mode).
Notes:
For synchronous-mode and interrupt-mode operations and for
DMA-mode operations on DAS-16 Series boards, memory is allocated
from the first 1MB of DOS memory only; therefore, the amount of
memory you can allocate may be limited.
For DAS-20 and DAS-HRES boards that run in DMA mode, it is
recommended that you use the Keithley Memory Manager before you
begin programming to ensure that you can allocate large enough memory
buffers. Refer to Appendix D for more information about the Keithley
Memory Manager.
To eliminate page wrap conditions and to guarantee that memory is
suitable for use by the computer’s controller, DASDLL_DMAAlloc may
allocate an area twice as large as actually needed. Once the data in this
buffer is processed and/or saved elsewhere, use DASDLL_DMAFree to
free the memory for other uses.
For Visual Basic for Windows, the program cannot transfer data directly
from the memory buffer . You must use the K_MoveBufToArray function
to move the data from the memory buffer to the program’s local array;
refer to page 4-81 for more information.
After you allocate your memory buffers, you must assign the starting
address of the buffers and the number of samples to store in the buffers.
Each supported programming language requires a particular procedure
for allocating a memory buffer and assigning the starting address. Refer
to the following for information:
Visual C++page 3-33
Visual Basic for Windowspage 3-37
2-9
Channels and Gains
Analog input channels on DASDLL-supported boards measure signals in
several analog input ranges. The analog input range for a particular
channel depends on the gain of the channel. The driver uses gain codes to
represent the gain.
For example, on a DAS-8PGA analog input board, an analog input range
of 0 to 10 V translates to a gain of 1 and a gain code of 9. Refer to
Appendix C for a summary of the gain codes used by DASDLLsupported boards.
For most DASDLL-supported boards, channels can be configured as
single-ended or differential. The number of channels supported depends
on which configuration you use.
Single Channel
If you require more than the supported number of channels, you can use
expansion accessories to increase the number of available channels. Refer
to your board’s user’s guide and to the appropriate expansion accessory
documentation for more information.
Refer to Appendix C for a summary of the number of channels on
DASDLL-supported boards.
You can perform an analog input operation on a single channel or on a
group of multiple channels. The following subsections describe how to
specify the channels you are using.
For single-mode analog input operations, you can acquire a single sample
from a single analog input channel. Use the K_ADRead function to
specify the channel and the gain code.
For synchronous-mode, interrupt-mode, and DMA-mode analog input
operations, you can acquire a single sample or multiple samples from a
single analog input channel. Use the K_SetChn function to specify the
channel and the K_SetG function to specify the gain code.
2-10Available Operations
Multiple Channels Using a Group of Consecutive Channels
For synchronous-mode, interrupt-mode, and DMA-mode analog input
operations, you can acquire samples from a group of consecutive
channels. Use the K_SetStartStopChn function to specify the first and
last channels in the group. The channels are sampled in order from first to
last; the channels are then sampled again until the required number of
samples is read.
Use the K_SetG function to specify the gain code for all channels in the
group. (All channels must use the same gain code.) Use the
K_SetStartStopG function to specify the gain code, the start channel,
and the stop channel in a single function call.
Multiple Channels Using a Channel-Gain Queue
For synchronous-mode, interrupt-mode, and DMA-mode analog input
operations, you can acquire samples from channels in a channel-gain
queue. In the channel-gain queue, you specify the channels you want to
sample, the order in which you want to sample them, and a gain code for
each channel.
You can set up the channels in a channel-gain queue either in consecutive
order or in nonconsecutive order. You can also specify the same channel
more than once. The channels are sampled in order from the first channel
in the queue to the last channel in the queue; the channels in the queue are
then sampled again until the required number of samples is read.
The way that you specify the channels and gains in a channel-gain queue
depends on the language you are using. Refer to the following for
information:
Visual C++page 3-33
Visual Basic for Windowspage 3-37
2-11
Pacer Clock
After you create the channel-gain queue in your program, use the
K_SetChnGAry function to specify the starting address of the
channel-gain queue.
Note: You can use a channel-gain queue with DMA-mode operations on
DAS-20 and DAS-40 Series boards only.
The pacer clock determines the period between the conversion of one
channel and the conversion of the next channel. For synchronous-mode,
interrupt-mode, and DMA-mode analog input operations, use the
K_SetClk function to specify one of the following pacer clocks:
●Internal pacer clock - The internal pacer clock uses an onboard
counter. You load a value into the counter to determine the period
between conversions. Depending on the time base of the counter,
each count represents a particular time period. T able 2-2 lists the time
bases available on DASDLL-supported boards.
Table 2-2. Time Bases
BoardTime Base
DAS-8Depends on PC bus clock frequency
DAS-8LT
DAS-8PGA
DAS-8PGA-02
DAS-8/AO
DAS-16 Series1 MHz or 10 MHz
DAS-205 MHz
DAS-40 Series4 MHz
DAS-HRES1 MHz, 8 MHz, or 10 MHz
DDA-06Not applicable2
Series 5001 MHz
2-12Available Operations
1 MHz
1
1
1
Table 2-2. Time Bases (cont.)
BoardTime Base
PIO SeriesNot applicable
PDMA Series10 MHz
Notes
1
Specified in the External DAS Driver configuration.
2
DDA-06 and PIO Series boards do not support an internal
pacer clock.
2
Use the K_SetClkRate function to specify the number of counts
(clock ticks) between conversions. For example, if you are using a
DAS-8PGA board (1 MHz time base), each count represents 1.0 µs. If
you specify a count of 30, the period between conversions is 30
µs
(33.33 ksamples/s).
When using an internal pacer clock, use the following formula to
For example, if you want a conversion rate of 10 ksamples/s on a
DAS-8PGA board, specify a count of 100, as shown in the following
equation:
1 000 000,,
-------------------------- -100=
10 000,
The internal pacer clock is the default pacer clock.
●External pacer clock - You connect an external pacer clock to the
appropriate pin on the main I/O connector.
When you start an analog input operation (using K_SyncStart,
K_IntStart, or K_DMAStart), conversions are armed. At the next
active edge of the external pacer clock (and at e very subsequent acti ve
edge of the external pacer clock), a conversion is initiated.
Refer to your DAS board’s user’s guide to determine which edge
(positive or negative) is the active edge supported for your board.
2-13
Loading...
+ 205 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.