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.
All 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 for DAS-4100
Series boards using the DAS-4100 Series Function Call Driver. The
DAS-4100 Series Function Call Dri ver supports the following DOS-based
languages:
●
●
Microsoft
Borland
C/C++ (Version 4.0 and higher)
C/C++ (Version 1.0 and higher)
The DAS-4100 Series Function Call Driver supports the following
Windows-based languages:
●
Microsoft C/C++ (Version 7.0 and higher)
Borland C/C++ (Version 4.0 and higher)
●
Microsoft Visual Basic
●
●
Microsoft Visual C++
for Windows (Version 3.0 and higher)
(Version 1.0 and higher)
The manual is intended for application programmers using a DAS-4100
Series boards in an IBM
PC AT
or compatible computer. It is assumed
that users have read the DAS-4100 Series User’s Guide to familiarize
themselves with the board’s features, and that they have completed the
appropriate hardware installation and configuration. It is also assumed
that users are experienced in programming in their selected language and
that they are familiar with data acquisition principles.
vii
The DAS-4100 Series Function Call Driver User’s Guide is organized as
follows:
●
Chapter 1 contains the information needed to install the DAS-4100
Series Function Call Driver and to get help.
Chapter 2 contains the background information needed to use the
●
functions included in the DAS-4100 Series Function Call Driver.
●
Chapter 3 contains programming guidelines and language-specific
information related to using the DAS-4100 Series Function Call
Driver.
●
Chapter 4 contains detailed descriptions of the DAS-4100 Series
Function Call Driver functions, arranged in alphabetical order.
●
Appendix A contains a list of the error codes returned by DAS-4100
Series Function Call Driver functions.
●
Appendix B contains instructions for converting counts to v oltage and
for converting voltage to counts.
CHAP01_.FRM Page 1 Wednesday, November 24, 1999 9:48 AM
1
Getting Started
The DAS-4100 Series Function Call Dri ver is a library of data acquisition
and control functions (referred to as the Function Call Driver or FCD
functions). It is part of the following two software packages:
●
DAS-4100 Series Standard Software package - This is the software
package that is shipped with DAS-4100 Series boards; it includes
utility programs, running under DOS, that allow you to configure,
calibrate, and test the DAS-4100 Series boards.
●
ASO-4100 software package - This is the Advanced Software
Option for DAS-4100 Series boards. You purchase the ASO-4100
software package separately from the board; it includes the following:
–Libraries of FCD functions for Microsoft C/C++ (for DOS) and
Borland C/C++ (for DOS).
–Dynamic Link Libraries (DLLs) of FCD functions for Microsoft
Visual Basic for Windows, Microsoft C/C++ (for Windows), and
Borland C/C++ (for Windows).
–Support files, containing program elements, such as function
prototypes and definitions of variable types, that are required by
the FCD functions.
–Utility programs, running under DOS, that allow you to
configure, calibrate, and test the DAS-4100 Series boards.
–Language-specific example programs.
Before you use the Function Call Driver, make sure that you have
installed the software, set up the board, and created a configuration file
using the setup and installation procedures described in the DAS-4100
Series User’s Guide .
1-1Getting Started
CHAP01_.FRM Page 2 Wednesday, November 24, 1999 9:48 AM
If you need help installing or using the DAS-4100 Series Function Call
Driver , call your local sales of fice or the K eithley MetraByte Applications
Engineering Department at:
(508) 880-3000
Monday - Friday, 8:00
An applications engineer will help you diagnose and resolve your
problem over the telephone.
Please make sure that you have the follo wing information av ailable before
you call:
DAS-4100 Series
board configuration
Computer
A.M.
- 6:00
Serial #
Revision code
Base I/O address setting
Memory address setting
Interrupt level setting
Manufacturer
CPU type
Clock speed (MHz)
KB of RAM
Video system
BIOS type
Memory manager
CHAP01_.FRM Page 4 Wednesday, November 24, 1999 9:48 AM
1-4
2
Available Operations
This chapter contains the background information you need to use the
FCD functions to perform operations on DAS-4100 Series boards. The
supported operations are listed in Table 2-1.
System Operations
This section describes the miscellaneous operations and general
maintenance operations that apply to DAS-4100 Series boards and to the
DAS-4100 Series Function Call Driver. It includes information on
initializing a driver, initializing a board, retrieving revision levels, and
handling errors.
Initializing the Driver
You must initialize the DAS-4100 Series 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 and the configuration file
that defines the use of the driver. The driver returns a unique identifier for
the driver; this identifier is called the driver handle.
Table 2-1. Supported Operations
OperationPage Reference
Systempage 2-1
Analog inputpage 2-4
System Operations2-1
Initializing a Board
You can specify a maximum of 30 driver handles for all the Keithley
MetraByte drivers initialized from all your application programs. If you
no longer require a driver and you want to free some memory or if you
have used all 30 driver handles, you can use the K_CloseDriver function
to free a driver handle and close the associated driver.
If the driver handle you free is the last driver handle specified for a
Function Call Driver, the driver is shut down. (For Windows-based
languages only, the DLLs associated with the Function Call Driver are
shut down and unloaded from memory.)
The DAS-4100 Series Function Call Driver supports up to two boards.
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 device handle.
Device handles allow you to communicate with more than one board. You
use the device handle returned by K_GetDevHandle in subsequent
function calls related to the board.
You can specify a maximum of 30 device handles for all the Keithley
MetraByte boards accessed from all your application programs. If a board
is no longer being used and you want to free some memory or if you have
used all 30 device handles, you can use the K_FreeDevHandle function
to free a device handle.
To reinitialize a board during an operation, use the K_DASDevInit
function. K_GetDevHandle and K_DASDevInit perform the following
tasks:
●
Abort all operations currently in progress that are associated with the
board identified by the device handle.
●
Verify that the board identified by the device handle is the board
specified in the configuration file associated with the board.
2-2Available Operations
Retrieving Revision Levels
If you are using functions from different Keithley DAS Function Call
Drivers in the same application program or if you are having problems
with your application program, you may want to verify which versions of
the Function Call Driver, Keithley DAS Driver Specification, and
Keithley DAS Shell are installed on your computer.
The K_GetVer function allows you to get both the revision number of the
DAS-4100 Series Function Call Driver and the revision number of the
Keithley 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 are shared by all DAS 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:
C/C++page 3-11
Visual Basic for Windowspage 3-19
For C-language application programs only, the DAS-4100 Series
Function Call Driver provides the K_GetErrMsg function, which gets
the address of the string corresponding to an error code.
System Operations2-3
Analog Input Operations
This section describes the following:
●
Analog input operation mode available.
How to allocate and manage memory for analog input operations.
●
●
How to specify the following for an analog input operation: a
channel, a gain and range, a clock source, a trigger source, and the
trigger acquisition type.
Operation Mode
DAS-4100 Series boards support interrupt mode only. In interrupt mode,
the board acquires multiple samples from the analog input channels. A
hardware clock initiates A/D conversions. Once the analog input
operation begins, control returns to your application program. The
hardware continues to store the acquired data in its onboard memory until
the specified number of samples is acquired, then transfers the data all at
once to a user-defined array or buffer in the computer using an interrupt
service routine.
Use the K_IntStart function to start an analog input operation in
interrupt mode. Use the K_IntStop function to stop an interrupt-mode
operation. Use the K_IntStatus function to determine the current status
of an interrupt-mode operation.
The converted data is stored as counts. For information on converting
counts to voltage, refer to Appendix B.
Memory Allocation and Management
Interrupt-mode analog input operations require a memory location in
which to store acquired data. Table 2-2 lists ranges for the DAS-4100
Series boards.
2-4Available Operations
Table 2-2. Sample Ranges
BoardSample Range
DAS-4101/64K1 to 64K
DAS-4101/256K1 to 256K
DAS-4101/1M1 to 1024K
DAS-4101/2M1 to 2048K
DAS-4102/64K1 to 128K
DAS-4102/256K1 to 512K
DAS-4102/1M1 to 2048K
Note:
Even though you can reserve a memory location greater than the
board requires, to conserve memory it is recommended that you allocate
only the required amount.
The ways you can allocate and manage memory are described in the
following sections.
Dimensioning a Local Array
The simplest way to reserve a memory location is to dimension an array
within your application program’s memory area. This is the
recommended way to reserve memory for this driver. The advantage of
this method is that the array is directly accessible to your application
program. The limitation of this method is that local arrays occupy
permanent memory areas; these memory areas cannot be freed to make
them available to other programs or processes.
Since the DAS-4100 Series Function Call Driver stores data in 16-bit
integers, you must dimension a local array as an integer data type.
Analog Input Operations2-5
Dynamically Allocating a Memory Buffer
You can allocate a memory buffer dynamically outside of your
application program’s memory area. The adv antages of this method are as
follows:
●
The size of the buffer is limited by the amount of free physical
memory available in your computer at run time.
A dynamically allocated memory buffer can be freed to make it
●
available to other programs or processes.
The limitation of this method is that, for Visual Basic for Windows,
●
data in a dynamically allocated buffer is not directly accessible to
your program. You must use the K_MoveBufToArray function to
move the data from the dynamically allocated buf fer to the program’s
local array; refer to page 4-30 for more information.
Use the K_IntAlloc function to dynamically allocate a memory buffer.
You specify the operation requiring the buffer and the number of samples
to store in the buffer, refer to Table 2-2. The driver returns the starting
address of the buffer and a unique identifier for the buffer (this identifier
is called the memory handle). When the buffer is no longer required, you
can free the buffer for another use by specifying this memory handle in
the K_IntFree function.
Note:
For DOS-based languages, the area used for dynamically allocated
memory buffers is referred to as the far heap; for Windows-based
languages, this area is referred to as the global heap. These heaps are
areas of memory left unoccupied as your application program and other
programs run.
For DOS-based languages, the K_IntAlloc function uses the DOS Int
21H function 48H to dynamically allocate far heap memory. For
Windows-based languages, the K_IntAlloc function calls the
GlobalAlloc API function to allocate the desired buffer size from the
global heap.
For Windows-based languages, dynamically allocated memory is
guaranteed to be fixed and locked in memory.
2-6Available Operations
Assigning the Starting Address
After you dimension your array or allocate your buffer, you must assign
the starting address of the array or buffer and the number of samples to
store in the array or buffer. Each supported programming language
requires a particular procedure for assigning a starting address. Refer to
the following for information:
Memory
Language
C/C++Array or BufferK_SetBufpage 4-38
LocationFunctionSee...
Visual Basic for
Windows
ArrayK_SetBufIpage 4-40
BufferK_SetBufpage 4-38
Channels
The DAS-4100 Series board provides up to two analog input channels;
the software refers to the analog input signal from the Channel A
connector as channel 0 and the analog input signal from the Channel B
connector as channel 1. You can perform an analog input operation on a
single channel at a time or both channels.
Acquiring Samples from a Single Channel
You can acquire a single sample or multiple samples from a single analog
input channel. For DAS-4102 boards use the K_SetChn function to
specify the channel. For DAS-4101 boards you can only acquire off
channel 0. Use K_SetG function to specify the gain code. Refer to the
next section for the various input ranges available.
Analog Input Operations2-7
Acquiring Samples from Both Channels
With DAS-4102 boards, you can acquire samples from both channels at
once. Use K_SetStartStopChn to specify channel 0 as the start channel
and channel 1 as the stop channel. The samples are gathered
simultaneously from both channels, but channel 0 is placed in the buffer
first before channel 1. Use K_SetG function to specify the gain code for
both channels. Refer to T able 2-3 on page 2-9 for the v arious input ranges
available.
Acquiring Samples Using a Channel-Gain Queue
With DAS-4102 boards, you can acquire samples from both channels
with different gain settings, using a channel-gain queue. In the
channel-gain queue, you specify the gain for channel 0 and channel 1.
Input Ranges
Channel 0 must be the first in the queue and channel 1 must be the other
channel in the list. The samples will be copied to the buffer in this order,
although they are acquired simultaneously.
The way that you specify the channel and gains in a channel-gain queue
depends on the language you are using. Refer to Chapter 4 for
information on programming the various drivers.
After you create the channel-gain queue in your program, use the
K_SetChnGAry function to transfer the contents of the channel-gain
queue to the driver/board.
Each channel on the DAS-4100 Series board can measure signals in one
of 16, software-selectable bipolar analog input ranges.
Table 2-3 lists the analog input ranges supported by DAS-4100 Series
boards and the gain code associated with each range. Use the K_SetG
function to specify the gain code. For the ±125 mV, ±250 mV , and ±0.5 V
analog input ranges, the choice of gain code affects the bandwidth; refer
to Appendix C of the DAS-4100 Series User’s Guide for more
information.
The pacer clock determines the period between A/D conversions. Use the
K_SetClk function to specify an internal or an external pacer clock. The
internal pacer clock is the default pacer clock.
The internal and external pacer clocks are described in the following
subsections; refer to the DAS-4100 Series User’s Guide for more
information.
Internal Pacer Clock
When you start an analog input operation (using K_IntStart ),
conversions are performed at a rate of 16.384 Gsamples/s divided by a
count value of 256, 512, 1024, 2048, 4096, 8192, 16384 or 32768. Use
the K_SetClkRate function to specify the count value. Each count
represents .0610351 ns between conversions.
Table 2-4 lists the conversion rates, sample periods, and count values for
the internal pacer clock.
Analog Input Operations2-9
Table 2-4. Available Conversion Rates Using Internal Clock
If you enter a count value that is not one of those listed in
Count
Value
Table 2-4, the driver uses the next fastest rate. For example, if you enter a
count value of 550, the driver uses a count value of 512 to perform the
faster conversion rate. To determine the actual count value used, use the
K_GetClkRate function.
External Pacer Clock
When you start an analog input operation (using K_IntStart ),
conversions are armed. At the next rising edge of the external pacer clock
(and at every subsequent rising edge of the external pacer clock), a
conversion is initiated.
Note:
using an external pacer clock or sample accuracy will not be guaranteed.
2-10Available Operations
Do not use a conversion rate greater than 64 Msamples/s when
Triggers
The conversion rate divisor, as set by K_SetClkRate , still has an effect,
with a conversion rate divisor of 256 producing the base rate specified by
the input clock frequency. Conversion rate divisors must go by powers of
two (for instance, 128, 256, 512, 1024) with lower divisors producing
higher conversion rates and higher divisors producing lower conversion
rates. Each doubling of the divisor has the net effect of halving the
effective digitization rate. Conversely, halving the divisor doubles the
effective digitization rate.
A trigger is an event that occurs based on a specified set of conditions.
The operation must have a start trigger that determines when the
acquisition starts. In addition, you can choose the optional about trigger to
determine when the acquisition stops.
Trigger Sources
You can define operations that acquire data after the trigger event occurs
(post-trigger acquisition), operations that acquire data before a trigger
event (pre-trigger acquisition), and operations that acquire data before
and after a trigger event (about-trigger acquisition). For post-trigger
acquisitions, you can also specify a post-trigger delay. If you specify an
about trigger, the operation stops when a specified number of samples has
been acquired after the occurrence of the about-trigger event.
When the trigger event occurs, a TTL-le v el signal is output on the Trigger
I/O connector. The signal is edge-sensitive with a positive polarity.
The following sections describe the supported trigger sources and the
ways to acquire data using triggers.
Use K_SetTrig to specify an internal or an external trigger source.
External triggers can be either analog triggers or digital triggers. The
trigger event is not significant until the operation the trigger governs has
been started (using K_IntStart ).
The internal trigger, external analog trigger, and external digital trigger
are described in the following subsections.
Analog Input Operations2-11
Internal T rigger
An internal trigger is a software trigger. The trigger event occurs when
you start the operation using the K_IntStart function. Note that there is a
slight delay between the time you start the operation and the time the
trigger event occurs. The internal trigger is the default trigger source.
External Analog Trigger
You can select the digitized analog input signal from the Channel A
connector (referred to in software as analog trigger channel 0) and/or
(with the DAS-4102 board) from the Channel B connector (referred to in
software as analog trigger channel 1). You program the trigger level as a
count value in 256 steps (
−
128 to +127) from
−
4 V to +3.96 V.
You can also select the ±16 V trigger input signal from the Analog T rigger
In connector (referred to in software as analog trigger channel 2) as the
trigger signal. You program the trigger level as a count value in 256 steps
(
128 to +127) from
−
16 V to +15.875 V. If you use analog trigger
−
channel 2, you can acquire analog input data from either the Channel A
connector or from the Channel B connector or both.
The trigger conditions for external analog triggers are illustrated in
Figure 2-1 and described as follows:
●Positiv e-Edge Trigger - A trigger event occurs the first time the
trigger signal changes from a voltage that is less than the trigger level
to a voltage that is greater than the trigger level.
●Negative-Edge Trigger - A trigger event occurs the first time the
trigger signal changes from a voltage that is greater than the trigger
level to a voltage that is less than the trigger level.
2-12Available Operations
Level + 5 V
0 V
Negative-edge
Positive-edge trigger occurs
trigger occurs
Analog input operation
start function is executed
Figure 2-1. Analog Trigger Conditions
Use the K_SetADT rig function to specify the analog input channel to use
as the trigger channel, the trigger level, and the trigger polarity. The
trigger sensitivity is always edge for the DAS-4100 Series board.
Refer to Appendix B for information on how to convert a voltage to a
count value.
External Digital Trigger
The digital trigger signal is connected to the Trigger I/O connector of the
DAS-4100 Series board. Use K_SetDITrig to specify the digital input
channel to use as the trigger channel and whether you want the trigger
event to occur on the rising edge of the digital trigger signal
(positive-edge trigger) or on a falling edge of the digital trigger signal
(negative-edge trigger). The trigger sensitivity is always edge for
DAS-4100 Series boards. The trigger events are illustrated in Figure 2-2.
Analog Input Operations2-13
Loading...
+ 97 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.