Tektronix DASDLL Function Call Driver Users Guide

DASDLL Function Call Driv er
USER’S GUIDE
DASDLL
Function Call Driver
Revision A – December 1994
Part Number: 86590
New Contact Information
Keithley Instruments, Inc.
28775 Aurora Road
Cleveland, OH 44139
Technical Support: 1-888-KEITHLEY
Monday – Friday 8:00 a.m. to 5:00 p.m (EST)
Fax: (440) 248-6168
Visit our website at http://www.keithley.com
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.
© Copyright Keithley Instruments, Inc., 1994.
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 DASDLL­supported 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.
x
Table of Contents
Preface
1
Getting Started
Installing the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-2
Setting Up the Board and the Driver . . . . . . . . . . . . . . . . . . . . . .1-3
Getting Help. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-4
Available Operations
2
System Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2
Initializing the Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2
Initializing a Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-3
Retrieving Revision Levels . . . . . . . . . . . . . . . . . . . . . . . . . . .2-5
Handling Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-5
Analog Input Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-6
Operation Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-6
Memory Allocation and Management. . . . . . . . . . . . . . . . . . .2-8
Channels and Gains. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-10
Single Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-10
Multiple Channels Using a Group of
Consecutive Channels. . . . . . . . . . . . . . . . . . . . . . . . . . .2-11
Multiple Channels Using a Channel-Gain Queue . . . . . .2-11
Pacer Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-12
Buffering Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-14
Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-14
Analog Trigger. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-15
Digital Trigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-16
Analog Output Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-17
Operation Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-17
Memory Allocation and Management. . . . . . . . . . . . . . . . . .2-18
Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-20
Single Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-21
Multiple Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-21
Pacer Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-21
Buffering Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-23
Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-24
iii
Digital I/O Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-25
Operation Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-25
Memory Allocation and Management. . . . . . . . . . . . . . . . . .2-27
Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-28
Pacer Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-30
Buffering Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-31
Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-32
Programming with the Function Call Driver
3
How the Driver Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-1
Programming Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-9
Preliminary Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-10
Operation-Specific Programming Tasks. . . . . . . . . . . . . . . . . . .3-10
Analog Input Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . .3-10
Single Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-11
Synchronous Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-11
Interrupt Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-13
DMA Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-15
Analog Output Operations . . . . . . . . . . . . . . . . . . . . . . . . . .3-17
Single Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-17
Synchronous Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-18
Interrupt Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-19
DMA Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-21
Digital I/O Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-23
Single Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-23
Synchronous Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-24
Interrupt Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-25
DMA Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-27
Language-Specific Programming Information. . . . . . . . . . . . . .3-29
Microsoft Visual C++ Language. . . . . . . . . . . . . . . . . . . . . .3-29
Allocating and Assigning Memory Buffers . . . . . . . . . . .3-30
Allocating the Memory Buffers. . . . . . . . . . . . . . . . . .3-30
Accessing the Data . . . . . . . . . . . . . . . . . . . . . . . . . . .3-31
Creating a Channel-Gain Queue . . . . . . . . . . . . . . . . . . .3-31
Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-32
Programming in Microsoft Visual C++ . . . . . . . . . . . . . .3-33
Microsoft Visual Basic for Windows. . . . . . . . . . . . . . . . . . .3-34
Allocating and Assigning Memory Buffers . . . . . . . . . . .3-34
Allocating the Memory Buffers. . . . . . . . . . . . . . . . . .3-34
Accessing the Data . . . . . . . . . . . . . . . . . . . . . . . . . . .3-35
iv
Creating a Channel-Gain Queue . . . . . . . . . . . . . . . . . . .3-35
Handling Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-37
Programming in Microsoft Visual Basic for Windows . .3-37
Function Reference
4
DASDLL_DevOpen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-7
DASDLL_DMAAlloc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-9
DASDLL_DMAFree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-11
DASDLL_GetBoardName. . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-12
DASDLL_GetDevHandle . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-13
K_ADRead. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-15
K_ClearFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-17
K_CloseDriver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-18
K_ClrContRun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-19
K_DASDevInit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-21
K_DAWrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-22
K_DIRead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-24
K_DMAStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-26
K_DMAStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-27
K_DMAStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-30
K_DOWrite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-32
K_FormatChnGAry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-34
K_FreeDevHandle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-35
K_FreeFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-36
K_GetADFrame. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-37
K_GetADTrig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-38
K_GetBuf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-40
K_GetBufB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-42
K_GetChn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-44
K_GetChnGAry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-45
K_GetClk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-46
K_GetClkRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-48
K_GetContRun. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-50
K_GetDAFrame. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-52
K_GetDevHandle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-54
K_GetDIFrame. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-56
K_GetDOFrame. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-58
K_GetErrMsg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-60
K_GetG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-61
K_GetShellVer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-63
K_GetStartStopChn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-65
K_GetStartStopG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-67
v
K_GetTrig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-69
K_GetVer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-71
K_IntStart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-73
K_IntStatus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-74
K_IntStop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-77
K_MoveArrayToBuf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-79
K_MoveBufToArray . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-81
K_OpenDriver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-83
K_RestoreChnGAry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-85
K_SetADTrig. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-86
K_SetBuf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-88
K_SetBufB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-90
K_SetChn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-92
K_SetChnGAry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-93
K_SetClk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-95
K_SetClkRate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-97
K_SetContRun . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-99
K_SetDMABuf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-101
K_SetDMABufB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-103
K_SetG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-105
K_SetStartStopChn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-106
K_SetStartStopG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-108
K_SetTrig. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-110
K_SyncAlloc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-112
K_SyncFree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-114
K_SyncStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-115
A
Error/Status Codes
Data Formats
B
Converting Counts to Voltage. . . . . . . . . . . . . . . . . . . . . . . . . . . B-1
Converting Voltage to Counts. . . . . . . . . . . . . . . . . . . . . . . . . . . B-4
C
Operating Specifications
Gains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-1
Channels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-8
vi
Keithley Memory Manager
D
Installing and Setting Up the KMM. . . . . . . . . . . . . . . . . . . . . . D-2
Using KMMSETUP.EXE . . . . . . . . . . . . . . . . . . . . . . . . . . . D-2
Using a Text Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-3
Removing the KMM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-4
Index
List of Figures
Figure 2-1. Logical Board Numbers. . . . . . . . . . . . . . . . . . . . .2-4
Figure 2-2. Analog Trigger Conditions . . . . . . . . . . . . . . . . .2-16
Figure 3-1. Single-Mode Function . . . . . . . . . . . . . . . . . . . . . .3-1
Figure 3-2. Interrupt-Mode Operation . . . . . . . . . . . . . . . . . . .3-3
List of Tables
Table 1-1. Boards Supported. . . . . . . . . . . . . . . . . . . . . . . . . .1-1
Table 2-1. Supported Operations . . . . . . . . . . . . . . . . . . . . . .2-1
Table 2-2. Time Bases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-12
Table 3-1. A/D Frame Elements . . . . . . . . . . . . . . . . . . . . . . .3-4
Table 3-2. D/A Frame Elements . . . . . . . . . . . . . . . . . . . . . . .3-6
Table 3-3. DI Frame Elements . . . . . . . . . . . . . . . . . . . . . . . .3-7
Table 3-4. DO Frame Elements. . . . . . . . . . . . . . . . . . . . . . . .3-8
Table 3-5. Setup Functions for Synchronous-Mode
Analog Input Operations . . . . . . . . . . . . . . . . . . .3-12
Table 3-6. Setup Functions for Interrupt-Mode
Analog Input Operations . . . . . . . . . . . . . . . . . . .3-14
Table 3-7. Setup Functions for DMA-Mode
Analog Input Operations . . . . . . . . . . . . . . . . . . .3-16
Table 3-8. Setup Functions for Synchronous-Mode
Analog Output Operations. . . . . . . . . . . . . . . . . .3-18
Table 3-9. Setup Functions for Interrupt-Mode
Analog Output Operations. . . . . . . . . . . . . . . . . .3-20
Table 3-10. Setup Functions for DMA-Mode
Analog Output Operations. . . . . . . . . . . . . . . . . .3-22
Table 3-11. Setup Functions for Synchronous-Mode
Digital Input and Output Operations . . . . . . . . . .3-24
Table 3-12. Setup Functions for Interrupt-Mode
Digital Input and Digital Output Operations . . . .3-26
Table 3-13. Setup Functions for DMA-Mode
Digital Input and Digital Output Operations . . . .3-28
Table 4-1. Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-2
vii
Table 4-2. Data Type Prefixes. . . . . . . . . . . . . . . . . . . . . . . . .4-6
Table A-1. Error/Status Codes. . . . . . . . . . . . . . . . . . . . . . . . A-1
Table B-1. Data Formats (Analog Input). . . . . . . . . . . . . . . . B-2
Table B-2. Full Scale Values . . . . . . . . . . . . . . . . . . . . . . . . . B-3
Table B-3. Data Formats (Analog Output) . . . . . . . . . . . . . . B-5
Table C-1. Gain Codes for DASDLL-Supported Boards . . . C-2
Table C-2. Gain Codes for Series 500 Boards. . . . . . . . . . . . C-6
Table C-3. Channels Available on
DASDLL-Supported Boards . . . . . . . . . . . . . . . . C-8
viii
1
Getting Started
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.
Table 1-1. Boards Supported
Series Boards
DAS-8 DAS-8, DAS-8LT, DAS-8PGA, DAS-8PGA-G2,
DAS-8/AO DAS-16 DAS-16, DAS-16F, DAS-16G1, DAS-16G2 DAS-20 DAS-20 DAS-40 DAS-40G1, DAS-40G2 DAS-HRES DAS-HRES DDA-06
500 AMM1A, AMM2, AIM2, AIM3A, AIM4, AIM6
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-2 Getting 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-4 Getting 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
DOS version Windows version Windows mode
Serial # Version Invoice/Order #
Language Manufacturer Version
_____________________ _____________________ _____________________ _____________________ _____________________ single-ended, differential unipolar, bipolar _____________________ _____________________
_____________________ _____________________ _____________________ _____________________ _____________________ _____________________
_____________________
3.0, 3.1 Standard, Enhanced
_____________________ _____________________ _____________________
_____________________ _____________________ _____________________
Accessories
Type/Number Type/Number Type/Number Type/Number Type/Number Type/Number Type/Number Type/Number
_____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________ _____________________
1-5
2
Available Operations
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
Operation Page Reference
System page 2-2 Analog input page 2-6 Analog output page 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:
More than two memory buffers per frame
Simultaneous sample-and-hold (SSH)
Programmable external pacer clock polarity About-trigger acquisition
Hardware gate
Counter/timer functions
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-2 Available 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-4 Available 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 Windows page 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:
Conversion mode – Clock source – Buffering mode – Trigger source
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-6 Available 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-8 Available 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 Windows page 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 DASDLL­supported 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-10 Available 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 Windows page 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
Board Time Base
DAS-8 Depends on PC bus clock frequency DAS-8LT
DAS-8PGA DAS-8PGA-02 DAS-8/AO
DAS-16 Series 1 MHz or 10 MHz DAS-20 5 MHz DAS-40 Series 4 MHz DAS-HRES 1 MHz, 8 MHz, or 10 MHz DDA-06 Not applicable2 Series 500 1 MHz
2-12 Available Operations
1 MHz
1
1
1
Table 2-2. Time Bases (cont.)
Board Time Base
PIO Series Not applicable PDMA Series 10 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
determine the number of counts to specify:
counts
time base
------------------------------------= conversion rate
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