The information contained in this manual is believed to be accurate and reliable. However, Keithley
Instruments, Inc., assumes no responsibility for its use or for any infringements of patents or other rights
of third parties that may result from its use. No license is granted by implication or otherwise under any
patent rights of Keithley Instruments, Inc.
KEITHLEY INSTRUMENTS, INC., SHALL NO T BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES RELATED TO THE USE OF THIS PRODUCT. THIS
PRODUCT IS NOT DESIGNED WITH COMPONENTS OF A LEVEL OF RELIABILITY
SUITABLE FOR USE IN LIFE SUPPORT OR CRITICAL APPLICATIONS.
Refer to your Keithley Instruments license agreement for specific warranty and liability information.
MetraByte is a trademark of Keithley Instruments, Inc. All other brand and product names are
trademarks or registered trademarks of their respective companies.
All rights reserved. Reproduction or adaptation of any part of this documentation beyond that permitted
by Section 117 of the 1976 United States Copyright Act without permission of the Copyright owner is
unlawful.
Keithley MetraByte Division
Keithley Instruments, Inc.
440 Myles Standish Blvd. Taunton, MA 02780
FAX: (508) 880-0179
Telephone: (508) 880-3000
●
Preface
The DAS-Scan Function Call Driver User’s Guide provides information
to help you write application programs for the DAS-Scan system using
the DAS-Scan Function Call Dri ver. The DAS-Scan Function Call Driver
supports the following Windows -based languages:
●
Microsoft
Borland
●
Microsoft Visual Basic
●
Visual C++ (up to Version 1.52)
C/C++ (Version 4.0 and 4.5)
for Windows (Version 3.0 and Version 4.0)
The manual is intended for application programmers using a DAS-Scan
system with an IBM
PC AT
or compatible computer. It is assumed that
you have read the DAS-Scan User’ s Guide to familiarize yourself with the
system’s features, and that you have completed the appropriate hardware
installation and configuration. It is also assumed that you are experienced
in programming in your selected language and that you are familiar with
data acquisition principles.
The DAS-Scan Function Call Driver User’s Guide is organized as
follows:
●
Chapter 1 contains the information needed to install the DAS-Scan
Function Call Driver, a summary of the DAS-Scan Function Call
Driver functions typically used when programming a DAS-Scan
system, a series of flow diagrams illustrating the procedures typically
used when programming a DAS-Scan system, and information on
how to get help.
Chapter 2 contains conceptual information about the DAS-Scan
●
Function Call Driver functions typically used when programming a
DAS-Scan system.
vii
Chapter 3 contains conceptual information about additional
●
DAS-Scan Function Call Driver functions you can use when
programming a DAS-Scan system.
Appendix A contains instructions for con v erting counts to voltage and
●
for converting counts to temperature.
An index completes this manual.
Keep the following conventions in mind as you use this manual:
●
References to Windows apply to Windows 3.1, Windows 3.11 for
Workgroups, and Windows 95. When a feature applies to a specific
Windows version, the complete version name is used.
Overview - a description of the DAS-Scan Function Call Driver.
●
●
Setup and Installation - a list of the tasks you should perform before
using the DAS-Scan Function Call Driver.
●
Summary of Functions - a brief description of the DAS-Scan
Function Call Driver functions that are typically used when
programming a DAS-Scan system.
●
Programming Flow Diagrams - an illustration of the procedures
you will typically follow when programming a DAS-Scan system
using the DAS-Scan Function Call Driver.
●
Getting Help - information on how to get help when installing or
using the DAS-Scan Function Call Driver.
1-1
Overview
The DAS-Scan Function Call Driver is a library of data acquisition and
control functions that is part of the ASO-SCAN software package. The
ASO-SCAN software package includes the following:
●
Dynamic Link Libraries (DLLs) of Function Call Driver functions for
Microsoft Visual C++, Borland C/C++, and Microsoft Visual Basic
for Windo ws.
●
Support files, containing program elements, such as function
prototypes and definitions of variable types, that are required by the
Function Call Driver functions.
Utility programs that allow you to configure, calibrate, and test the
●
functions of the DAS-Scan system.
●
Language-specific example programs.
Setup and Installation
Before you use the DAS-Scan Function Call Driver to program your
DAS-Scan system, make sure that you have performed the following
tasks. Refer to the DAS-Scan User’s Guide for more information.
1. Unpack and inspect the components of your DAS-Scan system.
2. Create a channel map indicating the input signals you want to attach
to each of the channels in your DAS-Scan system.
3. Configure the hardware components, as follows:
–On the SCAN-AD-HR board, set the base I/O address switch
(S1) to indicate the appropriate base I/O address, and, if
appropriate, set the J6 jumper to indicate an external pacer clock
or an external digital trigger/hardware gate.
–On each SCAN-BRD assembly, set the address thumbwheels to
indicate the appropriate assembly address.
–If you are using SCAN-STP-TC screw terminal panels, set the J2
jumpers on each panel to indicate whether you are using cold
junction compensation (CJC).
1-2Getting Started
4. Mount the SCAN-STP screw terminal panels on DIN rails.
5. Attach the input signals to the appropriate SCAN-STP screw terminal
panels.
6. Mount the SCAN-CH chassis in a 19-inch rack.
7. Attach one end of each SCAN-CAB-64 cable to the appropriate
position in the SCAN-CH chassis. (Do not attach the other end of the
SCAN-CAB-64 cables at this point.)
8. Attach a power cord to the power-supply panel of each SCAN-CH
chassis.
9. Check the operation of the power supply in each SCAN-CH chassis.
10. Install the SCAN-BRD assemblies in the appropriate SCAN-CH
chassis.
11. Make sure that power to the computer is turned OFF.
12. Install the SCAN-AD-HR board in your computer.
13. Attach the SCAN-AD-HR board to your first SCAN-CH chassis
using the S-1802/M cable.
14. Daisy-chain multiple SCAN-CH chassis, if required, using
S-1802/MM cables.
15. Attach the other end of each SCAN-CAB-64 cable to the appropriate
SCAN-STP screw terminal panel.
16. Connect an external pacer clock, external digital trigger, or hardware
gate, if required, to the J5 connector on the SCAN-AD-HR board
using a CAB-SMA-BNC cable.
17. Plug the power cords into the wall, and then power up your computer,
the SCAN-CH chassis, and any equipment attached to the
SCAN-STP screw terminal panels.
18. Install the ASO-SCAN software package.
19. Specify the configuration options for your DAS-Scan system in the
DAS-Scan Configuration Utility.
20. Test the functions of the DAS-Scan system using the DAS-Scan
Control Panel.
21. Look at the example programs provided with the ASO-SCAN
software package. Refer to the FILES.TXT file in the installation
directory for a list and description of the example programs.
Setup and Installation1-3
Summary of Functions
Table 1-1 describes the functions in the DAS-Scan Function Call Driver
that are typically used to program a DAS-Scan system. For more detailed
information about the functions, refer to Chapter 2 of this manual and to
the DAS-Scan Function Call Driver online help file (SCANFCD.HLP).
Table 1-1. Summary of Functions
Type of Function Name of FunctionDescription
InitializationK_OpenDriverInitializes a Function Call Driver.
K_CloseDriverCloses a Function Call Driver.
K_GetDevHandleInitializes a virtual board.
K_FreeDevHandleFrees a device handle.
K_DASDevInitReinitializes a virtual board.
Operation K_ADReadReads a single analog input value.
K_DMAStartStarts a DMA-mode operation.
K_DMAStatusGets the status of a DMA-mode operation.
K_DMAStopStops a DMA-mode operation.
DASSCAN_EventEnableEnables the generation of a Windows event
(C/C++).
DASSCAN_EventDisableDisables the generation of a Windows event
(C/C++).
Frame management K_GetADFrameAccesses a frame for an analog input operation.
K_FreeFrameFrees a frame.
K_ClearFrameSets all frame elements to their default values.
1-4Getting Started
Table 1-1. Summary of Functions (cont.)
Type of Function Name of FunctionDescription
Memory
management
Buffer address K_SetDMABufSpecifies the address of a dynamically
Channel and gainK_SetChnSpecifies a single logical channel.
K_DMAAllocDynamically allocates a memory buffer for a
DMA-mode operation.
K_DMAFreeFrees a memory buffer that was dynamically
allocated for a DMA-mode operation.
K_MoveBufToArrayTransfers data from a dynamically allocated
memory buffer to a local array (Visual Basic
for Windows).
allocated memory buffer.
K_SetStartStopChnSpecifies the first and last logical channels in a
group of consecutive logical channels.
K_SetGSpecifies the gain for a group of consecutive
logical channels.
K_SetStartStopGSpecifies the first and last logical channels in a
group of consecutive logical channels and the
gain for all channels in the group.
K_SetChnGArySpecifies the starting address of a channel-gain
queue.
K_FormatChnGAryConverts the format of a channel-gain queue
(Visual Basic for Windows).
K_RestoreChnGAryRestores a converted channel-gain queue
(Visual Basic for Windows).
K_SetADModeSpecifies the input range type (bipolar or
unipolar).
K_GetADModeGets the input range type (bipolar or unipolar).
Clock K_SetClkSpecifies the pacer clock source.
K_SetClkRateSpecifies the clock rate for the internal pacer
clock.
K_GetClkRateGets the clock rate for the internal pacer clock.
K_SetExtClkEdgeSpecifies the active edge of an external pacer
clock.
Summary of Functions1-5
Table 1-1. Summary of Functions (cont.)
Type of Function Name of FunctionDescription
TriggerK_SetTrigSpecifies the trigger source.
K_SetDITrigSets up a digital start trigger.
GateK_SetGateSpecifies the status of a hardware gate.
Miscellaneous K_GetErrMsgGets the address of an error message string
(C/C++).
K_GetVerGets revision numbers.
K_GetShellVerGets the current DAS shell version.
Programming Flow Diagrams
This section contains a series of programming flow diagrams illustrating
the procedures you will typically follow when programming a D AS-Scan
system using the DAS-Scan Function Call Driver. For more detailed
information about the programming procedures, refer to the DAS-Scan
Function Call Driver online help file (SCANFCD.HLP).
Although error checking is not shown in the flow diagrams, it is
recommended that you check the error/status code returned by each
function used in your application program.
1-6Getting Started
Preliminary Steps for All Analog Input Operations
Install all required files,
including the function and
variable type definition file
Declare and initialize program
variables
Initialize the driver
(K_OpenDriver)
Initialize a virtual board
(K_GetDevHandle)
Using another
virtual board?
No
Perform the steps appropriate to your
operation (see the operation-specific
flow diagrams)
Yes
Programming Flow Diagrams1-7
Steps for a Single-Mode Analog Input Operation
Declare a variable in which
to store a single analog
input value
Read the count value
(K_ADRead)
Convert the count value
to voltage or degrees
Operation complete
1-8Getting Started
Steps for a DMA-Mode Analog Input Operation
Access a frame for a virtual board
(K_GetADFrame)
Allocate a buffer
(K_DMAAlloc)
Specify the starting address
of the buffer
(K_SetDMABuf)
Continued on next page
Programming Flow Diagrams1-9
Steps for a DMA-Mode Analog Input Operation (cont.)
Continued from previous page
Using a
channel-
gain
No
Using a
group of
consecutive
channels?
Yes
Specify the starting address
of the channel-gain queue
Define the
channel-gain
queue
Using
Visual
Basic?
(K_SetChnGAry)
Yes
No
Specify the first and last channels
and the gain for all channels
K_SetStartStopChn and K_SetG)
Yes
(K_SetStartStopG or
Format the
channel-gain queue
(K_FormatChnGAry)
Modify the
channel-
gain
queue?
No
Yes
Restore the
channel-gain queue
(K_RestoreChnGAry)
No
Specify a single channel
(K_SetChn)
Specify the gain
for the single channel
(K_SetG)
Continued on next page
1-10Getting Started
Steps for a DMA-Mode Analog Input Operation (cont.)
Continued from previous page
Specify the clock source
(K_SetClk)
Using
internal
clock?
Specify the external clock edge
(K_SetExtClkEdge)
Using an
external
digital start
trigger?
Specify an internal start trigger
(K_SetTrig)
Using a
hardware
gate?
Yes
No
Yes
No
Yes
Set the clock rate
(K_SetClkRate)
Specify an external start trigger
(K_SetTrig)
Specify digital
trigger conditions
(K_SetDITrig)
Specify the gate polarity
(K_SetGate)
No
Disable the gate
(K_SetGate)
Continued on next page
Programming Flow Diagrams1-11
Steps for a DMA-Mode Analog Input Operation (cont.)
Continued from previous page
Setting up
another
virtual board?
No
Start the DMA-mode operation
(K_DMAStart)
Monitor the status of the operation
(K_DMAStatus)
Scanning
another
virtual board?
No
Yes
Yes
Access a frame for the virtual board;
go to the top of page 1-9
Continued on next page
1-12Getting Started
Steps for a DMA-Mode Analog Input Operation (cont.)
Continued from previous page
Using
Visual
Basic?
No
Read data
from each buffer
Convert data
from each buffer
Free each buffer
(K_DMAFree)
Free each frame
Yes
Transfer data from each
buffer to a local array
(K_MoveBufToArray)
Read data
from each array
Convert data
from each array
Operation complete
Programming Flow Diagrams1-13
Getting Help
If you need help installing or using the DAS-Scan Function Call Driver,
call your local sales office or call the following number for technical
support:
(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 hav e the follo wing
information available before you call:
SCAN-AD-HR
board configuration
SCAN-BRD
assembly
configuration
SCAN-BRD
assembly
configuration
A.M.
- 6:00
Serial #
Revision code
Base address setting
Interrupt level setting
DMA channel(s)
External clock, trigger, or gate
Model
Serial #
Revision code
Address setting (0h to 3Fh)
Unipolar or bipolar mode
Model
Serial #
Revision code
Address setting (0h to 3Fh)
Unipolar or bipolar mode