Text preview for : 78940B(DAS1800).pdf part of Keithley 78940B(DAS1800) Keithley DAS 78940B(DAS1800).pdf
Back to : 78940B(DAS1800).pdf | Home
over.frm Page 1 Thursday, April 14,1994 1:44 PM
DAM 800 Series
Function Call Driver
User's Guide
tlepg.frm Page 1 Thursday, April 14,1994 1:45 PM
$
DAS-1800 Series
Function Call Driver
User's Guide
-@
Revison B - April 1994
Part Number: 78940
1
sbotlcep.frm Page2 Thursday, April 14, 1994 1:46 PM
The information contained in this manual is believed to be accurateandreliable. However, the
manufacturer assumes responsibility for its use or for any infringements of patentsor other rights of
no
third parties that may result from its use.No license is grantedby implication or otherwise under any
patent rights of the manufacturer.
THE MANUFACTURER SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES RELATED TO THF!USE OF THIS PRODUCT. THIS PRODUCT
IS NOT DESIGNED WITH COMPONENTS OF A LEVEL OF RELIABILITY SUITABLE FOR USE
IN LIFB SUPPORTOR CRITICAL APPLICATIONS.
All brand and product namesare trademarksor registeredtrademarksof their respectivecompanies.
0 Copyright Keithley Instruments,Inc., 1993.1994.
All rights reserved.Reproduction or adaptationof any part of this documentationbeyond that permitted
by Section 117of the 1976 United StatesCopyright Act without permission of the Copyright owner is
unlawful.
-6llr
aft3.toc Page iii Thursday, April 14, 1994 1:46 PM
Table of Contents
Preface
1 Getting Started
2 Available Operations
System Operations ................................... .2-l
Initializing the Driver .............................. .2-2
Initializing a Board ................................ .2-2
Retrieving Revision Levels. ......................... .2-4
Handling Errors. .................................. .2-4
Analog Input Operations .............................. .2-4
Operation Modes. ................................. .2-5
Memory Allocation and Management ................. .2-6
Gains............................................2- 9
Channels........................................2-10
Specifying Channels When Using EXP-1800 Expansion
Boards (DAS-18OOST/HR Series Only). ......... .2-11
Acquiring Samplesfrom a Single Channel .......... .2- 13
Acquiring Samples from a Group of Consecutive
Channels...................................2-13
Acquiring SamplesUsing a Channel-Gain Queue. .... .2- 14
Conversion Modes ............................... .2- 15
Clock Sources ................................... .2- 15
Pacer Clock .................................. .2-16
Burst Mode Conversion Clock. ................... .2-17
Buffering Modes ................................. .2-18
Triggers.........................................2-19
Trigger Sources ............................... .2-19
Internal Trigger. ............................ .2-19
Analog Trigger ............................. .2-20
Digital Trigger. ............................. .2-22
Post-Trigger Acquisition ........................ .2-23
Pre-Trigger Acquisition ......................... .2-24
About-Trigger Acquisition. ...................... .2-25
Hardware Gates. ................................. .2-25
Analog Output Operations @AS-1800HC Series Only). .... .2-26
iii
aft3.toc Page iv Thursday, April 14, 1994 1:46 PM
Operation Modes ...................... ....... .2-U
Memory Allocation and Management ..... ....... .2-27
Channels ............................ ....... .2-28
ClockSource ......................... ....... .2-29
Buffering Modes ...................... ....... .2-30
Digital I/O Operations. ................... ....... .2-31
Operation Modes. ..................... ....... .2-31
Memory Allocation and Management ..... ....... .2-33
Digital Input Channel .................. ....... .2-34
Digital Output Channel ................. ....... .2-35
ClockSource ......................... ....... .2-36
Buffering Modes. ..................... ....... .2-38
3 Programming with the Function Call Driver
How the Driver Works. ............................. ,.3-l
Programming Overview. ............................ .3-10
Preliminary Tasks. ................................. .3-11
Operation-Specific Programming Tasks ................ .3-11
Analog Input Operations. ......................... .3-11
SingleMode ................................. .3-12
Interrupt Mode. .............................. .3-12
DMAMode ................................. .3-15
Analog Output Operations (DAS18COHC Series Only) . .3-18
SingleMode ................................. .3-18
Interrupt Mode. .............................. .3-18
Digital I/O Operations. ........................... .3-20
SingleMode ................................. .3-20
Interrupt Mode. .............................. .3-21
Language-Specific Programming Information ........... .3-22
C/C+tLanguages ............................... .3-23
Allocating and Assigning Dynamically Allocated
Memory Buffers ........................... .3-23
Single Memory Buffer ...................... .3-23
Multiple Memory Buffers. ................... .3-24
Accessing the Data ......................... .3-25
Dimensioning and Assigning Local Arrays. ........ .3-25
Single Array .............................. .3-26
Multiple Arrays. ........................... .3-26
Creating a Channel-Gain Queue ................. .3-27
Programming in Microsoft C/C++. ............... .3-28
Programming in Borland C/C++ ................. .3-29
Programming in Microsoft QuickC for Windows .... .3-30
raft3.toc Page v Thursday, April 14, 1994 1:46 PM
Programming in Microsoft Visual C++ ............. .3-31
PascalLanguages ............................... ..3-3 1
Allocating and Assigning Dynamically Allocated
Memory Buffers ........................... ..3-3 2
Reducing the Memory Heap. .................. .3-32
Single Memory Buffer ....................... .3-33
Multiple Memory Buffers. .................... .3-34
Accessing the Data .......................... .3-35
Dimensioning and Assigning Local Arrays. ......... .3-35
Single Array ............................... .3-36
Multiple Arrays ............................. .3-36
Creating a Channel-Gain Queue .................. .3-37
Programming in Borland Turbo Pascal (for DOS). .... .3-38
Programming in Borland Turbo Pascal for Windows .. .3-39
Microsoft Visual Basic for Windows ................. .3-40
Allocating and Assigning Dynamically Allocated
Memory Buffers ............................ .3-40
Single Memory Buffer ....................... .3-40
Multiple Memory Buffers. .................... .3-41
Accessing the Data .......................... .3-42
Dimensioning and Assigning Local Arrays. ......... .3-42
Single Array ............................... .3-42
Multiple Arrays ............................. .3-43
Creating a Channel-Gain Queue .................. .3-44
Programming in Microsoft Visual Basic for Widows . .3-45
BASIC Languages. ............................... .3-46
Allocating and Assigning Dynamically Allocated
Memory Buffers ............................ .3-46
Reducing the Memory Heap. .................. .3-46
Single Memory Buffer ....................... .3-46
Multiple Memory Buffers. .................... .3-47
Accessing the Data ......................... ..3-4 8
Dimensioning and Assigning Local Arrays. ......... .3-48
Single Array ............................... .3-49
Multiple Arrays ............................. .3-49
Creating a Channel-Gain Queue .................. .3-50
Programming in Microsoft QuickBasic (Version 4.0) .. .3-51
Programming in Microsoft QuickBasic (Version 4.5). .3-52
Programming in Microsoft Professional Basic
(Version 7.0) ............................... .3-53
Programming in Microsoft Visual Basic for DOS. .... .3-55
Y
aft3.toc Page vi Thursday, April 14, 1994 1:46 PM
4 Function Reference
DAS1800-DevOpen ..... . . ...4-8
DAS1800-GetDevHandle . . ...4-11
K-ADRead. ............ . ...4-14
K-BufListAdd .......... . ...4-17
K-ButListReset ......... . ...4-21
K-ClearFrame .......... . ...4-23
K-CloseDriver .......... . ...4-25
K-ClrAboutTrig. ........ . ...4-21
K-ClrADFreeRun ....... . ...4-29
K-ClrContRun .......... . . .4-31
K-DASDevInit ......... . .4-33
K-DAWrite ............ . ...4-35
K-DIRead ............. . ...4-38
K-DMAAlloc .......... . . .4-41
K-DMAFree ........... . ...4-45
K-DMAStart ........... . . . .4-47
KDMAStatus .......... . ...4-49
KPMAStop ........... . ...4-53
K-DOWrite ............ . . . .4-56
K-FormatClmGAry ...... . . .4-59
K-FreeDevHandle ....... . ...4-61
K-FreeFrame ........... . ...4-63
K-GetAboutTrig ........ . ...4-65
KGetADCommonMode. , . ...4-67
K-GetADConIig ........ . ...4-69
K-GetADFrsme. ........ . . .4-71
K-GetADFreeRun ....... . ...4-13
K-GetADMode ......... . ...4-76
KGetADTrig .......... . ...4-78
K-GetBuf. ............. . ...4-82
K-GetBurstTicks ........ . . .4-85
K-GetChn ............. . ...4-88
K-GetCbnGAry ......... . ...4-91
K-GetClk. ............. . ...4-93
K-GetClkRate .......... . ...4-96
K-GetContRun ......... . . . .4-99
K-GetDAFrsme. ........ . .4-102
K-GetDevHandle. ....... . . .4-105
K-GetDIFrame ......... . .4-107
K-GetDlTrig ........... . .4-110
KGetDOCurVal ........ .4-113
aft3.toc Page vii Thursday, April 14, 1994 1:46 PM
K-GetDOFrsme. ...... ....... . .4-116
K-GetErrMsg. ........ ....... . . . . .4-119
K-GetExtClkBdge ..... ....... . . ...4-121
K-GetG ............. ....... . . ...4-124
K-GetGate ........... ....... . .4-126
K-GetShellVer ........ ....... . .4-129
K-GetSSH ........... ....... . . . .4-132
K-GetStsrtStopChn .... ....... . . . .4-135
K-GetStartStopG ...... ....... . . ...4-138
K-GetTrig ........... ....... . . .4-142
KGetTrigHyst. ....... ....... . . ...4-145
K-GetVer ............ ....... . .4-148
KJntAlloc ........... . . . .4-151
K-IntFree ............ . . .4-154
K-IntStart. ........... . . .4-156
K-IntStatus .......... . . .4-158
K&Stop. ........... . . .4-162
KMakeDMABuf ...... . . . . .4-165
K-MoveArrayToBuf ... .4-167
K-MoveBuiToArray ... . . ...4-169
K-OpenDriver ........ . . ...4-171
K-RestoreChnGAry. ... . . .4-174
K-SetAboutTrig. ...... . . ...4-176
KSetADCommonMode . . ...4-179
K-SetADConfig. ...... . . ...4-181
K-SetADFreeRun ..... . . .4-183
K-SetADMode ....... . . .4-185
KSetADTrig ......... . . ...4-187
K-SetBuf ............ . . ...4-191
K-SetBufI ........... I. .4-194
K-SetBurstTicks ...... . . . . .4-196
K-SetChn. ........... . . . .4-198
KSetChnGAry ....... . . ...4-201
K-SetClk ............ . . ...4-204
K-SetClkRate ........ . . ...4-207
K-SetContRun. ....... . . ...4-210
K-SetDITrig. ......... . . ...4-212
K-SetDMABuf ....... . . ...4-215
K-SetExtClkEdge ..... . . ...4-218
K-SetG. ............. . . ...4-220
K-SetGate ........... . . ...4-222
KSetSSH ........... . . ...4-224
vii
e aft3.toc Page viii Thursday, April 14, 1994 1:46 PM
K-SetStartStopChu .............................. .4-226
K-SetStartStopG ................................ .4-230
K-SetTrig ...................................... .4-233
K-SetTrigHyst .................................. .4-236
A Error/Status Codes
B Data Formats
Converting Raw Counts to Voltage .................. .B-I
Converting Voltage to Raw Counts .................. .B-3
Specifying an Analog Output Value
@AS-1800HC Series only). .................. . . .B-3
Specifying an Analog Trigger Level. .............. . . .B-4
Specifying a Hysteresis Value. ................... .B-5
index
List of Figures
Figure 2-1. Example of Logical Channel Assignments .2-12
Figure 2-2. Trigger Events for Analog Triggers . . .2-20 +I+
Figure 2-3. Using a Hysteresis Value. . . . . . .... .2-22
Figure 2-4. Trigger Events For Digital Triggers . . . . .2-23
Figure 2-5. Digital Input Bits. ... .. ... . .2-34
Figure 2-6. Digital Output Bits. . . . . . . . . . . . . . .2-35
Figure 3-1. Single-Mode Function. ...... ... . ..3-2
Figure 3-2. Interrupt-Mode Operation . . ....... . ..3-3
4+
aft3.toc Page ix Thursday, April 14, 1994 I:46 PM
List of Tables
Table 2- 1. Supported Operations . . .2-l
Table 2-2. Analog Input Ranges. . . . . . . .2-10
Table 3-l. A/D Frame Elements. . . . . ~. . , . . . . . . . . . .3-5
Table 3-2. D/A Frame Elements. . . . ... . .3-7
Table 3-3. DI Frame Elements . . . . . . . . . . . . . . . . . . . . . ...3-8
Table 3-4. DO Frame Elements . . . , . . . . . . . . . . . . . ..3-9
Table 3-5. Setup Functions for Interropt-Mode
Analog Input Operations. . . . . . . . . . . ,3-13
Table 3-6. Setup Functions for DMA-Mode
Analog Input Operations. . . . .3-16
Table 3-7. Setup Functions for Interrupt-Mode
Analog Output Operations. . . . ... . . .3-19
Table 3-8. Setup Functions for Interrupt-Mode
Digital Input and Digital Output Operations. . .3-21
Table 4- 1. Functions. . . . . . . . . . . . . . . . . . . . . . . ...4-2
Table 4-2. Data Type Prefixes . .. . . . .4-7
Table A-1. Error/Status Codes. . . .. .. .. A-l
Table B-l. Span Values For Data Conversion Equations. . .B-2
ix
a-llraft3.toc Pagex Thursday, April 14, 1994 1:46 PM
43
reface.frm Page xi Thursday, April 14, 1994 1:47 PM
Preface
The DA.51800 Series Function Call Driver User's Guide describes how
to write application programs for DAS-1800 Series boards using the
DAS-1800 Series Function Call Driver. The DAS-1800 Series Function
Call Driver supports the following DOS-based languages:
. Microsoft' QuickBasic" (Versions 4.0 and 4.5)
. Microsoft Professional Basic (Version 7.0 and higher)
. Microsoft Visual BasicTM DOS (Version 1.0)
for
. Microsoft C/C++ (Version 4.0 and higher)
. Borland@ C/C++ (Version 1.0 and higher)
. Borland Turbo Pascal@ DOS (Version 6.0 and higher)
for
The DAS-1800 Series Function Call Driver also supports the following
Windows"-based languages:
. Microsoft Visual Basic for Windows (Version 1.0 and higher)
. Microsoft Quick@ for Windows (Version 1.0)
. Microsoft Visual C++w (Version 1.0)
. Borland Turbo Pascal for Windows (Version 1.0 and higher)
xi
b
+b
reface.frm Page xii Thursday, April 14, 1994 1:47 PM
The manual is intended for application programmers using a DAS-1800
Series board in an IBM@ PC AT@or compatible computer. It is assumed
that users have read the user's guide for their board to familiarize
themselveswith the board's features, and that they have completed the
appropriate hardware installation and configuration. It is also assumed
that users am experienced in programming in their selected language and
that they are familiar with data acquisition principles.
The DAS-1800 SeriesFunction Cal/ Driver User's Guide is organized as
follows:
Chapter 1 contains the information needed to install the DAS-1800
Series Function Call Driver and to get help.
Chapter 2 contains the background information needed to use the
functions included in the DAS-1800 Series Function Call Driver.
Chapter 3 contains programming guidelines and language-specific
information related to using the DAS- 1800 Series Function Call
Driver.
Chapter 4 contains detailed descriptions of the DAS-1800 Series
Function Call Driver functions, arranged in alphabetical order.
Appendix A contains a list of the error codes returned by DAS-1800
Series Function Call Driver functions.
Appendix B contains instructions for converting raw counts to
voltage and for converting voltage to raw counts.
An index completes this manual.
Keep the following conventions in mind as you use this manual:
. Referencesto DA%1800 Series boards apply to all members of the
DAS-1800 family. When a feature applies to a particular board, that
board's name is used.
. Referencesto BASIC apply to all DOS-based BASIC languages
(Microsoft QuickBasic, Microsoft Professional Basic, and Microsoft
Visual Basic for DOS). When a feature applies to a specific language,
the complete language name is used. References to Visual Basic for
Windows apply to Microsoft Visual Basic for Windows.
. Keyboard keys are enclosed in square brackets ([I).
xii
b
a- - hap01 .frm Page 1 Thursday, April 14,1994 1:47 PM
Getting Started
The DAS-1800 SeriesFunction Call Driver 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-1800 standard software package - This is the software
package that is shipped with DAS-1800 Series boards; it includes the
following:
- Libraries of FCD functions for Microsoft QuickBasic, Microsoft
Professional Basic, and Microsoft Visual Basic for DOS.
- Support files, containing such program elements as function
prototypes and definitions of variable types, which are required
+b by the FCD functions.
- Utility programs, running under DOS, that allow you to
configure, calibrate, and test the functions of DAS-1800 Series
boards.
- Language-specific example programs.
. ASO- software package This is the Advanced Software
Option for DAS-1800 Series boards. You purchase the ASO-
software package separately from the board; it includes the following:
- Libraries of FCD functions for Microsoft C/C++, Borland
C/C++, and Borland Turbo Pascal.
- Dynamic Link Libraries (DLLs) of FCD functions for Microsoft
Visual Basic for Windows, Microsoft QuickC for Windows,
Microsoft Visual C-r+, and Borland Turbo Pascal for Windows.
- Support tiles, containing program elements,such as function
prototypes and definitions of variable types, that are required by
the FCD functions.
1-l
km Page 2 Thursday, April 14,1994 1:47 PM
- Utility programs, running under DOS and Windows, that allow
you to configure, calibrate, and test the functions of DAS-1800
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 tile
using the setup and installation procedures described in Chapter 3 of the
user's guide for your DAS-1800 Series board.
If you need help installing or using the DAS-1800 Series Function Call
Driver, call your local salesoffice or the factory.
l-2 Getting Started
4b hapOlL.frm Page 3 Thursday, April 14, 1994 1:47 PM
Pleasemake sure that you have the following information available
before you call:
DAS-lgOOST/HR Model
Series Board Serial #
Configuration Revision code
Baseaddresssetting
Interrupt level setting
Number of channels
Input (S.E. or Diff.)
Mode (uni. or bip.)
DMA than(s)
Number of SSH-8s
Number of EXPs.
Computer Manufacturer
CPU type
Clock speed(MHz)
KB of RAM
Wdeo system
BIOS type
4 Operating System DOS version
WIndow version
Windows mode
Software package Name
Serial #
Version
Invoice/Order #
Compiler LUlgUag?
(if applicable) Manufacturer
Version
Accessories
l-3
4 4
.frm Page4 Thursday, April 14,1994 1:47 PM
4 4 4
$ b-hap02 .frm Page 1 Thursday, April 14,1994 1:48 PM
2
Available Operations
This chapter contains the background information you need to use the
FCD functions to perform operations on DAS-1800 Series boards. The
supported operations are listed in Table 2-1.
Table 2-1. Supported Operations
Operation Page Reference
4
Svstem ODerations
This section describes the miscellaneous operations and general
maintenance operations that apply to DA%1800 Series boards and to the
DAS-1800 Series Function Call Driver. It includes information on
initializing a driver, initializing a board, retrieving revision levels, and
handling errors.
2-l
4 4
+b-
hap02Qrm Page 2 Thursday, April 14.1994 1:48 PM
Initializing the Driver
Before you can use any of the functions included in the DAS-1800 Series
Function Call Driver, you must initialize the driver using one of the
following driver initialization functions:
. Board-specific driver initialization function - If you want to
initialize the DAS-1800 SeriesFunction Call Driver only, use the
board-specific driver initialization function DAS1800 DevOpen.
You specify a configuration file; DASlSOO-Devopeiinitializes the
driver according to the configuration file you specify.
. Generic driver initialization function - If you want to initialize
several different DAS Function Call Drivers from the same
application program, use the generic driver initialization function
K-OpenDriver. You specify the DAS board you are using, the
configuration file that defines this particular use of the driver, and the
driver handle (a name that uniquely identifies the particular use of the
driver). You can specify a maximum of 30 driver handles for all the
DAS boards accessedfrom your application program.
If a particular use of a driver is no longer required 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
associateduse of the driver.
If the driver handle you free is the last driver handle specified for a
Function Call Driver, the driver is shut down. @or Windows-baaed
languages only, the DLLs associatedwith the Function Call Driver
are shut down and unloaded from memory.)
Initializing a Board
The DAS-1800 SeriesFunction Call Driver supports up to three boards.
You must use a hoard initialization function to specify the hoard(s) you
want to use and the name you want to use to identify each board, this
name is called the board handle. Board handles allow you to
communicate with more than one board. You use the hoard handle you
specify in the board initialization function in all subsequentfunction calls
related to the board.
2-2 Available Operations
.frm Page 3 Thursday, April 14,1994 1:48 PM
The DAS-1800 Series Function Call Driver provides the following board
initialization functions:
. Board-specific board initialization function - If you want to
initialize a DAS-1800 Series board only, use the hoard-specific board
initialization function DASlSOO-GetDevHandle.
. Generic board initialization function - If you want to initialize
several different supported DAS boards from the same application
program, use the generic board initialization function
K-GetDevHandle. You can specify a maximum of 30 board handles
for all the DAS hoards accessedfrom 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.
To reinitialize a board during an operation, use the K-DASDevInit
function, which performs the following tasks:
. Abort all operations currently in progress that are associatedwith the
hoard identified by the board handle.
. Verify that the board identified by the board handle is the board
specified in the configuration file.
2-3
43
hap02Lfrm Page 4 Thursday, April 14, 1994 1:48 PM
Retrieving Revision Levels
If you are using functions from different 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, DAS Driver Specification, and DAS Shell are
installed on your board. The K-GetVer function allows you to get both
the revision number of the DAS-1800 SeriesFunction Call Driver and the
revision number of the DAS Driver Specification to which the driver
conforms. The K-GetShellVer function allows you to get the revision
number of the DAS Shell (the 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
ensurethat 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.
For C-language application programs only, the DAS-1800 Series
Function Call Driver provides the K-GetErrMsg function, which gets
the addressof the string corresponding to an error code.
Analog Input Operations
This section describes the following:
l Analog input operation modes available.
. How to allocate and manage memory for analog input operations.
l How to specify the following for an analog input operation: channels
and gains, a conversion mode, a clock sonrce, a buffering mode, a
trigger source, and a hardware gate.
2-4 Available Operations
$ thap02 -.frm Page 5 Thursday, April 14, 1994 1:48 PM
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 the
computer. You can perform analog input operations in one of the
following modes:
. Single mode - In single mode, the board acquires a single sample
from an analog input channel. The driver initiates conversions; you
cannot perform any other operation until the single-mode operation is
complete.
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.
. 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. The
+b hardware temporarily storesthe acquired data in the onhoard PIP0
(first-in, fist-out data buffer) and then transfers the data to a
user-defined buffer in the computer using an interrupt service routine.
Use the K-IntStart function to start an analog input operation in
interrupt mode. You specify the hoard, analog input channel(s),
gain(s), clock source, buffering mode, buffer address( trigger
source, and gate use.
You can specify either single-cycle or continuous buffering mode for
interrupt-mode operations. Refer to page 2-18 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 samplesfrom one or more analog input channels. A
hardware clock initiates conversions. Once the analog input operation
begins, control returns to your application program. The hardware
temporarily stores the acquired data in the onboard FIFO (first-in,
2-5
hap02-.frm Page 6 Thursday, April 14,1994 1:48 PM
first-out data buffer) and then transfers the data to a user-defined
DMA buffer in the computer.
Note: You can perform an analog input operation in single-DMA
mode or dual-DMA mode, depending on whether you specified one
or two DMA channels in your configuration file. Refer to your
DAS-1800 Series board user's guide for more information.
Use the K-DMAStart function to start an analog input operation in
DMA mode. You specify the board, analog input channel(s), gain(s),
clock source, buffering mode, buffer address( trigger source, and
gate use.
You can specify either single-cycle or continuous buffering mode for
DMA-mode operations. Refer to page 2-18 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.
The converted data are stored as raw counts. For information on
converting raw counts to voltage, refer to Appendix B. -+
Memory Allocation and Management
Interrupt-mode and DMA-mode analog input operations require memory
buffers in which to store the acquired data. You can reserve a single
memory buffer, or you can reserve multiple buffers (up to a maximum of
150) to increase the number of samplesyou can acquire. The maximum
number of sampleseach memory buffer can store (32K or 64K) depends
on the language you are using. See "Language-Specific Programming
Information" on page 3-22 for more information.
2-6 Available Operations
hap02-.frm Page 7 Thursday, April 14, 1994 1:48 PM
You can reservethe required memory buffer(s) in one of the following
ways:
. Within your application program's memory area -The simplest
way to reservememory buffers is to dimension arrays within your
application program. The advantageof this method is that the arrays
are directly accessibleto your application program. The limitations of
this method are as follows:
- Certain programming languages limit the size of local arrays.
- Local arrays may not be suitable for DMA-mode operations.
- Local arrays occupy permanent memory areas;these memory
areascannot be freed to make them available to other programs or
processes.
Since the DAS-1800 Series Function Call Driver stores data in 16-bit
integers, you must dimension all local arrays as integers.
. Outside of your application program's memory area - This is the
recommended way to reserve memory buffers. The advantagesof this
method are as follows:
- The number of buffers and the size of each buffer are limited by
the amount of free physical memory available in your computer
at run-time.
- The dynamically allocated memory buffers can be freed to make
them available to other programs or processes.
The limitation of this method is that, for BASIC and Visual Basic
languages, the data in a dynamically allocated memory buffer is not
directly accessibleby your program. vhe DAS-1800 Series Function
Call Driver provides a function, K-MoveButToArray, to make this
data accessible;refer to page 4-169 for more information.)
2-7
b
4+
hapOZ.frm Page 8 Thursday, April 14,1994 1:48 PM
Use the K-IntAlloc function to allocate memory dynamically for
interrupt-mode operations and the K-DMAAlloc function to allocate
memory dynamically for DMA-mode operations. You specify the
operation requiring the buffer, the number of samplesto store in the
buffer, the variable to store the starting addressof the buffer, and the
name you want to use to identify the buffer (this name 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 (for interrupt-mode operations) or the
K-DMAFree function (for DMA-mode operations).
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 areasof memory left unoccupied as your application
program and other programs run.
For DOS-based languages,the K-IntAlloc and K-DMAAlloc
functions use the DOS Int 21H function 48H to dynamically allocate
far heap memory. For Windows-based languages,the K-IntAlloc and
K-DMAAlloc functions call the GlohalAlloc API function to
allocate the desired buffer size from the global heap.
For Windows-based languages,dynamically allocated memory is
guaranteedto be fixed and locked in memory.
To eliminate page wrap conditions and to guarantee that dynamically
allocated memory is suitable for use by the computer's 8237 DMA
controller, K-DMAAlloc may allocate an area twice as large as
actually needed.Once the data in this buffer is processedand/or saved
elsewhere, use K-DMAFree to free the memory for other uses.
2-0 Available Operations
b
-43
hap02-.frm Page 9 Thursday, April 14, 1994 1:48 PM
After you allocate your buffer(s), you must assign the starting addressof
the buffer(s) and the number of samplesto store in the buffer(s). Each
supported programming language requires a particular procedure for
allocating memory buffers and assigning starting addresses. Refer to page
3-23 for information when programming in C. Refer to page 3-31 for
information when programming in Pascal. Refer to page 3-40 for
information when programming in Visual Basic for Windows. Refer to
page.3-46 for information when programming in BASIC.
If you are using multiple buffers, use the K-BufListAdd function to add
each buffer to the list of multiple buffers associatedwith each operation
and to assign the starting addressof each buffer. Use the K-BufListReset
function to clear the list of multiple buffers.
Note: If you are using multiple buffers, it is recommended that you use
the Keithley Memory Manager before you begin programming to ensure
that you can allocate large enough buffers. Refer to your DAS-1800
Series board user's guide for more information about the Keithley
Memory Manager.
Gains
Each channel on a DA%1800 Series board can measure analog input
signals in one of four, software-selectableunipolar or bipolar analog input
ranges. The input range type (unipolar or bipolar) is initially set according
to your configuration file; use K-SetADMode to reset the input range
type. Refer to your DAS-1800 Series board user's guide for more
information.
Table 2-2 lists the analog input ranges supported by DAS-1800 Series
boards and the gain and gain code associatedwith each range. (The gain
code is used by the FCD functions to represent the gain.)
a-
hap02Lfrm Page 10 Thursday, April 14, 1994 1:48 PM
Table 2-2. Analog Input Ranges
Analog input Range
Gain
Boards Bipolar Unipolar Gain Code
DAS-1SOlHC 32 v OtO5V 1 0
DASl801ST
DAS-1802ST
DAS1802HR
EXP-1800attached
DAS-1802STwith
EXP-1800attached:
DAS-1802HRwith
EXP-1800attached
Channels
DAS-18OOHCSeriesboards configured
are with either64 single-endedor
32 differential analog input channels, depending on the input
configuration specified in your configuration file. DAS-1800ST/HR
Series boards are configured with either 16 onboard single-ended or 8
onboard differential analog input channels. On DAS-1800ST/HR Series
boards, you can increase the number of channels to 256 single-ended or
128 differential channels using the EXP-1800 expansion board, described
in the next section.
Z-10 Available Operations
&- hap02-.frm Page 11 Thursday, April 14,1994 1:48 PM
The input channel configuration is initially set according to the
configuration file; use K-SetADConfIg to reset the input channel
configuration, Use K-SetADCommonMode to set the common-mode
ground reference for DAS-1800ST/HR Series boards in single-ended
input channel configuration.
You can perform an analog input operation on a single channel or on a
group of multiple channels.The following subsectionsdescribe how to
specify the channel(s) you are using.
Speciwing Channels When Using EXP-1800 Expansion Boards
(DAS-18OOST/HR Series Only)
To increase the number of analog input channels, you can attach up to 16
EXP-1800 expansion boards to the DA%1800 Series board. Each
EXP-1800 board has 16 analog input channels. If you are using
N EXP-1800 boards, you must attach them to DAS-1800 channels 0 to
N-l, Refer to the DAS-1800STlHR Series User's Guide for information on
connecting EXP-1800 boards to DAS-1800ST/HR Series boards.
The analog input channel connections on a DAS-1800 Series board or
EXP-1800 board are labelled with white-on-green numbers from 0 to 15.
These numbers are the physical channel numbers. If a system includes a
DAS-1800 Series board and one or moreEXP-1800 boards, then that
system contains duplicate physical channel numbers. To uniquely identify
a physical channel, the Function Call Driver uses a schemeof logical
channel numbers.The channel# argument for any FCD function must be
specified as a logical channel number.
2-11
.frm Page 12 Thursday, April 14, 1994 1:48 PM
The logical channel
numbercorresponding a particularphysical
to
channel number is given by one of the following equations:
If the physical channel is on a DAS-1800 Series board:
LogicalChat+ = PhysicalCharS + (15 x NumEXPs)
If the physical channel is on an EXP-1800 board:
LogicalChan# = PhysicalChan# + ( 16 x EXP#)
NumEXPs is an integer from 0 to 15 that identifies the number of
EXP-1800 boards connected to the DAS-1800 Series board, and
EXP# is an integer from 0 to 15 that indicates on which EXP-1800
board the physical channel is located (0 indicates the first EXP-1800
board).
For example, consider the system illustrated in Figure 2-1, in which three
EXP-1800 boards are connected to a DAS-18OlST.
0 1 2 ,,, 15
EXP #O Logical Channels 0 to 15
0 1 2 15
EXP #I Logical Channels 16 lo 3,
0 1 2 15
EXP #2 Logical Channels 32 b 47
DA.51sOlST 3 Logical Channel 48
15 Logical Channel 60
I
Figure 2-1. Example of Logical Channel Assignments
2-12 Available Operations
.frm Page 13 Thursday, April 14,1994 1:48 PM
The logical channel that identities channel 3 on the DAS-1801 board is
given by:
LogicnlChan# = 3 + (15 x 3) = 3 + 45 = 48
The logical channel that identities channel 15 on the third EXP-1800
board is given by:
LogicalChad = 15 + (16 x 2) = 15 + 32 = 41
Acquiring Samples from a Single Channel
You can acquire a single sample or multiple samplesfrom a single analog
input channel.
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 interrupt-mode and DMA-mode analog input operations, you can
acquire a single sample or multiple samplesfrom a single analog input
channel. Use the K-SetChn function to specify the channel and the
K-WC function to specify the gain code.
Acquiring Samples from a Group of Consecutive Channels
For interrnpt-mode and DMA-mode analog input operations, you can
acquire samplesfrom 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 are read.
For example, assumethat the start channel is 14, the stop channel is 17,
and you want to acquire five samples.Your program reads data first from
channel 14, then from channels 15, 16, and 17. and finally from channel
14 again.
You can specify a start channel that is higher than the stop channel. For
example, assumethat you are using a differential input configuration, the
start channel is 31, the stop channel is 2, and you want to acquire five
samples.Your program reads data fist from channel 3 1, then from
channels 0, 1, and 2, and fmally from channel 3 1 again.
2-13
.frm Page 14 Thursday, April 14, 1994 1:48 PM
Use the K-SetC function to specify the gain code for all channels in the
group. (All channels must use the same gain code.) Use the
K-SetStartStopC function to specify the gain code, the start channel,
and the stop channel in a single function call.
Refer to Table 2-2 on page 2-10 for a list of the analog input ranges
supported by DAS-1800 Series boards and the gain code associatedwith
each range.
Acquiring Samples Using a Channel-Gain Queue
For interrupt-mode and DMA-mode analog input operations, you can
acquire samplesfrom channels in a hardware channel-ga