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-4301/8K boards using the DAS-4300 Series Function Call Driver.
The DAS-4300 Series Function Call Driver supports the following
DOS-based languages:
●
●
Microsoft
Borland
C/C++ (Version 4.0 and higher)
C/C++ (Version 1.0 and higher)
The DAS-4300 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
●
for Windows (Version 3.0 and higher)
The manual is intended for application programmers using a
DAS-4301/8K board in an IBM
PC AT
or compatible computer. It is
assumed that users have read the DAS-4300 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-4300 Series Function Call Driver User’s Guide is organized as
follows:
●
Chapter 1 contains the information needed to install the DAS-4300
Series Function Call Driver and to get help.
Chapter 2 contains the background information needed to use the
●
functions included in the DAS-4300 Series Function Call Driver.
●
Chapter 3 contains programming guidelines and language-specific
information related to using the DAS-4300 Series Function Call
Driver.
●
Chapter 4 contains detailed descriptions of the DAS-4300 Series
Function Call Driver functions, arranged in alphabetical order.
●
Appendix A contains a list of the error codes returned by DAS-4300
Series Function Call Driver functions.
●
Appendix B contains instructions for converting counts to v oltage and
for converting voltage to counts.
●
Appendix C present bandwidth charts for the supported input ranges.
Figure C-5.±0.125 V Input Range (Gain Code 4) . . . . . . . . . C-3
Figure C-6.±0.15625 V Input Range (Gain Code 5) . . . . . . . C-4
Figure C-7.±0.3125 V Input Range (Gain Code 6) . . . . . . . . C-4
Figure C-8.±0.625 V Input Range (Gain Code 7) . . . . . . . . . C-5
Figure C-9.±0.1 V Input Range (Gain Code 8) . . . . . . . . . . . C-5
Figure C-10. ±0.125 V Input Range (Gain Code 9) . . . . . . . . . C-6
Figure C-11. ±0.25 V Input Range (Gain Code 10) . . . . . . . . . C-6
Figure C-12. ±0.5 V Input Range (Gain Code 11) . . . . . . . . . . C-7
Figure C-13. ±0.025 V Input Range (Gain Code 12) . . . . . . . . C-7
Figure C-14. ±0.03125 V Input Range (Gain Code 13) . . . . . . C-8
Figure C-15. ±0.0625 V Input Range (Gain Code 14) . . . . . . . C-8
Figure C-16. ±0.125 V Input Range (Gain Code 15) . . . . . . . . C-9
1
Getting Started
The DAS-4300 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-4300 Series Standard Software package - This is the software
package that is shipped with DAS-4301/8K boards; it includes utility
programs, running under DOS, that allow you to configure, calibrate,
and test the DAS-4301/8K boards.
●
ASO-4300 software package - This is the Advanced Software
Option for DAS-4301/8K boards. You purchase the ASO-4300
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-4301/8K 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-4300
Series User’s Guide .
1-1
If you need help installing or using the DAS-4300 Series Function Call
Driver, call your local sales office or the Keithley 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-4301/8K 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
This chapter contains the background information you need to use the
FCD functions to perform operations on DAS-4301/8K boards. The
supported operations are listed in Table 2-1.
Table 2-1. Supported Operations
OperationPage Reference
Systempage 2-1
Analog inputpage 2-4
System Operations
This section describes the miscellaneous operations and general
maintenance operations that apply to DAS-4301/8K boards and to the
DAS-4300 Series Function Call Driver. It includes information on
initializing a driver, initializing a board, retrieving revision levels, and
handling errors.
System Operations2-1
Initializing the Driver
You must initialize the DAS-4300 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.
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.)
Initializing a Board
The DAS-4300 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.
2-2Available Operations
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.
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-4300 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-10
Visual Basic for Windowspage 3-17
System Operations2-3
For C-language application programs only, the DAS-4300 Series
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 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-4301/8K boards support interrupt mode only. In interrupt mode, the
board acquires multiple samples from a single analog input channel. 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.
2-4Available Operations
Memory Allocation and Management
Interrupt-mode analog input operations require a memory location in
which to store acquired data. DAS-4301/8K boards can transfer up to
8,192 samples (bytes) to this memory location.
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 (maximum of 8,192 bytes).
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-4300 Series Function Call Driver stores data in 16-bit
integers, you must dimension a local array as an integer data type.
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.
Analog Input Operations2-5
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 buffer to the program’s local array;
refer to page 3-16 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 (maximum of 8,192). 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.
Notes:
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:
Channels
Input Ranges
Language
C/C++Array or
Visual Basic for WindowsArrayK_SetBufIpage 3-15
The DAS-4301/8K board provides two analog input channels; the
software refers to the analog input signal from the Ch A connector as
channel 0 and the analog input signal from the Trg/Ch B connector as
channel 1. Y ou can perform an analog input operation on a single channel
at a time. To acquire samples from both channels, you must alternate
between the two channels after an acquisition is done.
You can acquire a single sample or multiple samples from a single analog
input channel. Use the K_SetChn function to specify the channel.
Memory
Location
Buffer
BufferK_SetBufpage 3-16
FunctionSee...
K_SetBufpage 3-9
Each channel on the DAS-4301/8K board can measure signals in one of
16, software-selectable bipolar analog input ranges.
T able 2-2 lists the analog input ranges supported by D AS-4301/8K boards
and the gain code associated with each range. Use the K_SetG function
to specify the gain code. Refer to Appendix C to understand the effect of
the input range on the bandwidth of the DAS-4301/8K board.
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-4300 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 20 Gsamples/s divided by a count
value of 20, 40, 80, 200, 400, 800, 1600, 3200, 6400, 12800, or 25600.
Use the K_SetClkRate function to specify the count value. Each count
represents .05 ns between conversions.
Table 2-3 lists the conversion rates, sample periods, and count values for
the internal pacer clock.
2-8Available Operations
Table 2-3. Available Conversion Rates Using Internal Clock
If you enter a count value that is not one of those listed in Table
Count
Value
2-3, the driver uses the next f astest rate. F or e xample, if you enter a count
value of 50, the driver uses a count value of 40 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.
Do not use a conversion rate less than 100 Msamples/s when using an
external pacer clock or an error will result.
Analog Input Operations2-9
Triggers
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.
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 T r g IO
connector. The signal is edge sensitive with a positive polarity.
Trigger Sources
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.
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.
2-10Available Operations
External Analog Trigger
You can select the digitized analog input signal from the Ch A connector
(referred to in software as analog trigger channel 0) or from the Tr g/Ch B
connector (referred to in software as analog trigger channel 1) as the
trigger signal. You program the trigger level as a count value in 256 steps
(
128 to +127). If you use analog trigger channel 0 or 1, you must acquire
−
data from the same channel you are using as the trigger channel. For
example, if you specify 0 as the trigger channel, you must also acquire
analog input data from the Ch A connector by specifying 0 in K_SetChn .
You can also select the ±10 V trigger input signal from the Trg/Ch B
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
(
127 to 128) from
−
10 V to +9.922 V. If you use analog trigger channel
−
2, you can acquire analog input data from either the Ch A connector or
from the Trg/Ch B connector.
Note:
Even though the resolution of the ±10 V range is 12 bits in
hardware, the driver accepts only 8 bits, resulting in the loss of some
accuracy.
The trigger conditions for external analog triggers are illustrated in Figure
2-1 and described as follows:
Positive-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.
Analog Input Operations2-11
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_SetADTrig 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-4301/8K 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 Trg IO connector of the
DAS-4301/8K 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-4301/8K boards. The trigger events are illustrated in Figure 2-2.
2-12Available Operations
Trigger Acquisition
Positive-edge
trigger event occurs
Trigger signal
Negative-edge
trigger event occurs
Figure 2-2. Digital Trigger Conditions
The maximum number of samples you can collect for each trigger event
is 8,192. The minimum number of samples you can collect for each
trigger event depends on the conversion rate as follows:
Conversion rate of 100 Msamples/s and slower : minimum of 1
●
sample in increments of 1 sample.
Conversion rate of 250 Msamples/s and faster : minimum of 10
●
samples in increments of 10 samples.
The ways you can acquire data using triggers are described in the
following subsections.
Post-Trigger Acquisition
Use post-trigger acquisition in applications where you want to collect
data after a specific trigger event. You specify a start trigger only; the start
trigger determines when the operation starts and can be either an internal,
an external analog, or an external digital trigger. To stop the operation,
use the K_IntStop function. If desired, you can specify the number of
samples to wait between when the trigger event occurs and when the data
is collected by using the K_SetPostTrigDelay function.
Analog Input Operations2-13
At a conversion rate of 100 Msamples/s or slower, the post-trigger delay
can range from 0 to 65,536 samples (in increments of 1); at a conversion
rate of 250 Msamples/s or faster, the post-trigger delay can range from 0
to 655,360 samples (in increments of 10).
To specify post-trigger acquisition, perform the following steps:
1. Specify the start trigger.
–Use K_SetTrig to specify an internal or an external trigger
source (specify external for an analog or digital trigger).
–If you specify an external start trigger in K_SetTrig, define the
start trigger conditions using K_SetADTrig (for an analog
trigger) or K_SetDITrig (for a digital trigger).
2. If you specified an external analog or digital start trigger, use
K_ClrAboutTrig to disable the about trigger.
3. T o specify the number of post-trigger samples to wait after the trigger
event occurs and before data is collected, use K_SetPostTrigDelay.
Pre-Trigger Acquisition
Use pre-trigger acquisition in applications where you want to collect data
before a specific trigger event. The operation starts when your application
program calls the K_IntStart function. The about trigger can be either an
external analog or external digital trigger; the operation stops when the
about-trigger event occurs.
Note: The memory buffer must fill up with data at least once before the
board can accept a trigger event.
To specify pre-trigger acquisition, perform the following steps:
1. Use K_SetTrig to specify an external about-trigger source (external
analog or external digital trigger).
2. Use K_SetAboutTrig to enable the about trigger and to set the
number of samples to 1.
2-14Available Operations
Loading...
+ 100 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.