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
This chapter contains conceptual information about the DAS-Scan
Function Call Driver functions typically used when programming a
DAS-Scan system. It includes the following sections:
●
System Operations - information on initializing the Function Call
Driver, initializing a virtual board, generating a Windows event,
retrieving revision levels, and handling errors.
●
Analog Input Operations - information on operation modes,
accessing a frame, memory allocation and management, gains,
channels, the pacer clock, and triggers.
System Operations
This section describes the miscellaneous operations and general
maintenance operations that apply to the entire DAS-Scan system and to
the DAS-Scan Function Call Driver. It includes information on
initializing the Function Call Driver, initializing a virtual board,
generating a Windows event, retrieving revision levels, and handling
errors.
Initializing the Driver
You must initialize the DAS-Scan 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.
Specify the driver you are using and the configuration file that defines the
use of the driver. The driver returns a unique identifier for the driver; this
identifier is called the driver handle.
System Operations2-1
You can specify a maximum of 30 driver handles for all the Keithley
MetraByte drivers initialized from all your application programs. If you
no longer require a driver and you want to free some memory or if you
have used all 30 driv er handles, use the K_CloseDriver function to free a
driver handle and close the associated driver.
If the driver handle you free is the last driver handle specified for a
Function Call Driver, the driver is shut down. The DLLs associated with
the Function Call Driver are shut down and unloaded from memory.
Initializing a Board
Each DAS-Scan system contains one physical SCAN-AD-HR board that
you plug into your computer. You can attach up to 64 physical
SCAN-BRD assemblies to the SCAN-AD-HR. Each SCAN-BRD
assembly contains 64 physical channels.
The DAS-Scan Function Call Driver treats each group of four
SCAN-BRD assemblies as a virtual board. Each virtual board contains
256 logical channels (four SCAN-BRD assemblies multiplied by 64
physical channels on each). Refer to page 2-12 for information on how
the logical channels map to the virtual board.
The driver supports 16 virtual boards for a total of 4,096 logical channels
(16 virtual boards multiplied by 256 logical channels on each). You must
use the K_GetDevHandle function to initialize each virtual board you
want to use. Specify the driver handle and the virtual board number (0 to
15). K_GetDevHandle verifies that the SCAN-AD-HR board is present
at the base address specified in the configuration file, stops any operations
currently in progress, initializes the SCAN-AD-HR board to its default
state, and calibrates the analog-to-digital converter on the SCAN-AD-HR
board.
K_GetDevHandle returns a unique identifier for each virtual board; this
identifier is called the device handle. Device handles allow you to
communicate with more than one virtual board. Use the device handle
returned by K_GetDevHandle in subsequent function calls related to the
virtual board.
You can specify a maximum of 30 device handles for all the Keithley
DAS products accessed from all your application programs. If you are no
longer using a Keithley DAS product and you want to free some memory
2-2Available Operations
or if you have used all 30 device handles, use the K_FreeDevHandle
function to free a device handle.
Use K_GetDevHandle the first time you initialize a board only. To
reinitialize a virtual board after you have called K_GetDevHandle , use
the K_DASDevInit function.
Generating a Windows Event
If you are performing a DMA-mode operation and programming in
C/C++, you can program your DAS-Scan system to generate an interrupt
when the operation stops (either because the specified number of samples
was read or because an error, such as an o verflo w, occurred). You can then
use the interrupt to generate a Windows event.
By default, the generation of Windows events is disabled. Use the
DASSCAN_EventEnable function to enable the generation of Windows
events. When an interrupt is generated, a Windows event is generated and
a message is sent to your application program. Your application program
can then take the appropriate action. Use the DASSCAN_EventDisable
function to disable the generation of Windows events.
Notes:
DASSCAN_EventDisable ) before closing your application program.
The DAS-Scan Function Call Driver does not support the generation of
Windows events when programming in Visual Basic for Windows.
If a Windows event is generated, the wParam parameter of the message
structure specifies the status of the operation as returned in the pStatus
variable of K_DMAStatus . Refer to the DAS-Scan Function Call Driver
online help file (SCANFCD.HLP) for more information about
K_DMAStatus .
You can generate a Windows event only if you are performing an
operation in single-cycle buffering mode (the default buffering mode). If
you change the buffering mode to continuous mode, the generation of
Windows events is no longer supported. Refer to page 3-23 for
information on when you can use continuous buffering mode.
Always disable the generation of Windows events (using
System Operations2-3
Retrieving Revision Levels
If you are using functions from different Keithley DAS Function Call
Drivers in the same application program or if you are having problems
with your application program, you may want to verify which versions of
the Function Call Driver, Keithley DAS Driver Specification, and
Keithley DAS Shell are used by the DAS-Scan system.
The K_GetVer function allows you to get both the revision number of the
DAS-Scan Function Call Driver and the revision number of the Keithley
DAS Driver Specification to which the driver conforms.
The K_GetShellVer function allows you to get the revision number of
the Keithley DAS Shell (the Keithley DAS Shell is a group of functions
that are shared by all Keithley DAS products).
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 the DAS-Scan Function Call Driver online
help file (SCANFCD.HLP) for a complete list of error codes.
Each supported programming language uses a different procedure for
error checking. Refer to the DAS-Scan Function Call Driver online help
file (SCANFCD.HLP) for language-specific information.
For C/C++ application programs only, the DAS-Scan Function Call
Driver provides the K_GetErrMsg function, which gets the address of
the string corresponding to an error code.
2-4Available Operations
Analog Input Operations
This section describes analog input operations. It includes information on
the operation modes available, ho w to access a frame, ho w to allocate and
manage memory, and how to specify channels and gains, the pacer clock
source, and the trigger source for an analog input operation.
Operation Modes
The operation mode determines which attributes you can specify for an
analog input operation and how data is transferred from the
SCAN-AD-HR board to computer memory . Y ou can perform analog input
operations in single mode or DMA mode, as described in the following
sections.
Single Mode
DMA Mode
In single mode, the SCAN-AD-HR board acquires a single sample from a
single logical channel. The driver initiates the conversion; you cannot
perform any other operation until the single-mode operation is complete.
Use the K_ADRead function to perform an analog input operation in
single mode. You specify the virtual board that the logical channel is
associated with, the logical channel, the gain at which you want to read
the signal, and the variable in which to store the converted data.
The data in the variable is stored as a count value. Refer to Appendix A
for information on converting the count value to voltage or degrees.
DMA mode is the recommended way to transfer data. In DMA mode, the
SCAN-AD-HR board acquires a single sample or multiple samples from
one or more logical channels (up to a maximum of 256) on the same
virtual board. 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 FIFO (first-in,
first-out data buffer) on the SCAN-AD-HR board and then transfers the
data to a user-defined DMA buffer in the computer.
Analog Input Operations2-5
Use the K_DMAStart function to start the DMA-mode operation on the
first virtual board, specifying the handle of the frame that defines the first
operation. After the SCAN-AD-HR board reads a sample from each
logical channel associated with the virtual board and stores the samples in
the user-defined buffer, the operation stops. (Use the K_DMAStatus
function to monitor the status of the operation and determine when the
operation stops.) Then, use K_DMAStart again to start the DMA-mode
operation on the next virtual board, specifying the handle of the frame
that defines the next operation.
Refer to page 1-9 for the procedure to follow when performing a
DMA-mode operation. In addition, example programs 1 and 3, provided
in the ASO-SCAN software package, illustrate how to acquire data in
DMA mode.
The data in the user-defined DMA buffer is stored as count values. Refer
to Appendix A for information on con v erting the count v alue to voltage or
degrees.
Notes:
Because of the overhead required to stop one DMA-mode
operation and start another, a slight delay occurs before the DAS-Scan
system begins acquiring data on each subsequent virtual board.
If DMA resources are not available, you can also perform an analog input
operation in interrupt mode, using interrupts to indicate when data should
be transferred from the FIFO. Refer to page 3-19 for more information.
Typically, you want the operation to stop automatically after one sample
from each logical channel on the virtual board has been read; this is
referred to as single-cycle buffering mode. However, if you are acquiring
data from 256 logical channels or fewer, you can also use continuous
buffering mode; this allo ws you to continuously acquire data, o verwriting
any values already stored in memory. Refer to page 3-23 for more
information.
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 the DAS-Scan User’s Guide
for more information.
2-6Available Operations
Accessing a Frame
A frame is a data structure whose elements define the attributes of a
DMA-mode analog input operation. For each virtual board in your
DAS-Scan system, use the K_GetADFrame function to access an A/D
(analog-to-digital) frame. The driver returns a unique identifier for each
frame; this identifier is called the frame handle.
Specify the attributes of each operation by using a separate setup function
to define each element of the A/D frame. Use the frame handle returned
by the driver in each setup function to ensure that you always define the
operation for the same virtual board. For example, assume that you access
an A/D frame with the frame handle ADFrame1. To specify the logical
channel on which to perform the operation, use the K_SetChn setup
function, referencing the frame handle ADFrame1; to specify the gain at
which to read the logical channel, use the K_SetG setup function, also
referencing the frame handle ADFrame1.
When you are ready to perform the operation you set up, use the
K_DMAStart function to start the operation, again referencing the
appropriate frame handle. Figure 2-1 illustrates the use of an A/D frame
where the frame handle is ADFrame1.
First analog input channel
Last analog input channel
Pacer clock source
Trigger source
.
.
.
Analog Input Operations2-7
Frames help you create structured application programs. They are useful
for operations that have many defining attributes, since providing a
separate argument for each attribute could make a function’ s ar gument list
unmanageably long. In addition, some attributes, such as the clock source
and trigger source, are only available for operations that use frames.
You must use as least as many frames as you have virtual boards. For
example, if you are using 16 virtual boards (the maximum number), you
must use at least 16 frames. The maximum number of frames that you can
use in your application program is 32 (two for each virtual board).
Note:
To acquire data from all the virtual boards in your DAS-Scan
system as smoothly as possible, make sure that you define the elements of
each frame consistently . For e xample, to use the same pacer clock rate for
all the virtual boards in your DAS-Scan system, specify the same number
of clock ticks for each frame.
If you want to perform a DMA-mode operation on a virtual board and all
frames have been accessed, use the K_FreeFrame function to free a
frame that is no longer in use. You can then redefine the elements of the
frame for the next operation.
When you access a frame, the elements are set to their default values. You
can also use the K_ClearFrame function to reset all the elements of a
frame to their default values.
Table 2-1 lists the elements of an A/D frame that are typically defined for
a DAS-Scan system. This table also lists the default value of each
element, the setup functions used to define each element, and the page(s)
in this manual on which to find additional information. Refer to the
DAS-Scan Function Call Driver online help file (SCANFCD.HLP) for
more detailed information about the setup functions.
2-8Available Operations
Table 2-1. A/D Frame Elements
ElementDefault ValueSetup FunctionPage Number
1
Buffer
Number of Samples0K_SetDMABufpage 2-9
Start Channel0K_SetChnpage 2-17
A DMA-mode analog input operation requires memory in which to store
the acquired data.
To reserve memory, use the K_DMAAlloc function to dynamically
allocate a memory buffer for each virtual board. Specify the number of
samples to store in the buffer (typically, one sample for each logical
channel associated with the virtual board). The driver returns the starting
Analog Input Operations2-9
address of the buffer and a unique identifier for the buffer (this identifier
is called the memory handle).
When you no longer require the buffer , you can free the b uf fer for another
use by specifying the memory handle in the K_DMAFree function.
After you allocate your buffer, use the K_SetDMABuf function to assign
the starting address of the buffer and the number of samples to store in the
buffer.
Notes:
For Visual Basic for Windows, data in a dynamically allocated
buffer is not directly accessible to your program. You must use the
K_MoveBufToArray function to move the data from the dynamically
allocated buffer to the program’s local array.
If you are writing Windows 95, 32-bit programs, you must install the
Keithley Memory Manager. Refer to your board user’s guide for
information.
Typically, a single buffer that can hold one sample for each logical
channel associated with the virtual board is sufficient. Howe ver , if you are
acquiring data from 256 logical channels or fewer , you can also allocate a
larger buffer or multiple buffers, allowing you to sample each logical
channel multiple times. Refer to page 3-24 for more information.
The area used for dynamically allocated memory buffers is referred to as
the global heap. This area of memory is left unoccupied as your
application program and other programs run. The K_DMAAlloc function
calls the GlobalAlloc API function to allocate the desired buffer size
from the global heap. Dynamically allocated memory is guaranteed to 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 processed and/or saved elsewhere,
use K_DMAFree to free the memory for other uses.
2-10Available Operations
Gains
Each logical channel of your DAS-Scan system can measure analog input
signals in one of eight, software-selectable unipolar or bipolar analog
input ranges. You initially set the input range type (unipolar or bipolar) for
each virtual board in your configuration file; refer to the DAS-Scan User’ s
Guide for more information. To reset the input range type for a virtual
board in your application program, use the K_SetADMode function.
T able 2-2 lists the analog input ranges supported by the D AS-Scan system
and the gain and gain code associated with each range. (The gain code is
used by the Function Call Driver to represent the gain.)
Table 2-2. Analog Input Ranges
Analog Input Range
Gain
Gain
±10 V0 to 10 V10
±5 V0 to 5 V21
±2.5 V0 to 2.5 V42
±1.25 V0 to 1.25 V83
±0.2 V0 to 0.2 V504
±0.1 V0 to 0.1 V1005
±50 mV0 to 50 mV2006
±25 mV0 to 25 mV4007
CodeBipolarUnipolar
For a single-mode operation, you specify the gain code in the
K_ADRead function.
For a DMA-mode operation, you specify the gain code in the K_SetG or
K_SetStartStopG function; the function you use depends on how you
specify the logical channels, as described in the following section.
Analog Input Operations2-11
Channels
A DAS-Scan system can contain a maximum of 4,096 analog input
channels. You can perform an analog input operation on a single channel
or on a group of multiple channels called a scan. The following sections
describe how to address and specify the channels you are using.
Addressing Channels
As mentioned previously, each DAS-Scan system contains one physical
SCAN-AD-HR board that you plug into your computer. You can attach up
to 64 physical SCAN-BRD assemblies to the SCAN-AD-HR. You give
each SCAN-BRD assembly a unique address (from 0h to 3Fh, 0 to 63
decimal) by setting a thumbwheel on the board. Each SCAN-BRD
assembly contains 64 physical channels, numbered from 0 to 63 on each
assembly.
The DAS-Scan Function Call Driver treats each group of four
SCAN-BRD assemblies as a virtual board. Because duplicate physical
channel numbers can be associated with a virtual board, the driver uses a
logical channel number (from 0 to 255) to uniquely identify each physical
channel . The channel number that you specify in Function Call Driver
functions is always a logical channel number.
Table 2-3 illustrates the mapping of logical channels to virtual boards for
the maximum configuration of 4,096 channels. Table 2-3 assumes that
when you set the address thumbwheels on the SCAN-BRD assemblies
and specified the addresses in the configuration file, you assigned the
SCAN-BRD assemblies sequential addresses, as recommended.
However, you can assign any address to any SCAN-BRD assembly, as
long as no two SCAN-BRD assemblies have the same address.
2-12Available Operations
Table 2-3. Virtual Boards and Logical Channels
Virtual
BoardSCAN-BRD Assemblies
0SCAN-BRD0 (Address 0h)0 to 63
SCAN-BRD1 (Address 1h)64 to 127
SCAN-BRD2 (Address 2h)128 to 191
SCAN-BRD3 (Address 3h)192 to 255
1SCAN-BRD0 (Address 4h)0 to 63
SCAN-BRD1 (Address 5h)64 to 127
SCAN-BRD2 (Address 6h)128 to 191
SCAN-BRD3 (Address 7h)192 to 255
2SCAN-BRD0 (Address 8h)0 to 63
SCAN-BRD1 (Address 9h)64 to 127
SCAN-BRD2 (Address Ah)128 to 191
SCAN-BRD3 (Address Bh)192 to 255
3SCAN-BRD0 (Address Ch)0 to 63
SCAN-BRD1 (Address Dh)64 to 127
Logical
Channels
SCAN-BRD2 (Address Eh)128 to 191
SCAN-BRD3 (Address Fh)192 to 255
4SCAN-BRD0 (Address 10h)0 to 63
SCAN-BRD1 (Address 11h)64 to 127
SCAN-BRD2 (Address 12h)128 to 191
SCAN-BRD3 (Address 13h)192 to 255
5SCAN-BRD0 (Address 14h)0 to 63
SCAN-BRD1 (Address 15h)64 to 127
SCAN-BRD2 (Address 16h)128 to 191
SCAN-BRD3 (Address 17h)192 to 255
Analog Input Operations2-13
Table 2-3. Virtual Boards and Logical Channels (cont.)
Virtual
BoardSCAN-BRD Assemblies
6SCAN-BRD0 (Address 18h)0 to 63
SCAN-BRD1 (Address 19h)64 to 127
SCAN-BRD2 (Address 1Ah) 128 to 191
SCAN-BRD3 (Address 1Bh) 192 to 255
7SCAN-BRD0 (Address 1Ch) 0 to 63
SCAN-BRD1 (Address 1Dh) 64 to 127
SCAN-BRD2 (Address 1Eh) 128 to 191
SCAN-BRD3 (Address 1Fh)192 to 255
8SCAN-BRD0 (Address 20h)0 to 63
SCAN-BRD1 (Address 21h)64 to 127
SCAN-BRD2 (Address 22h)128 to 191
SCAN-BRD3 (Address 23h)192 to 255
9SCAN-BRD0 (Address 24h)0 to 63
SCAN-BRD1 (Address 25h)64 to 127
Logical
Channels
SCAN-BRD2 (Address 26h)128 to 191
SCAN-BRD3 (Address 27h)192 to 255
10SCAN-BRD0 (Address 28h)0 to 63
SCAN-BRD1 (Address 29h)64 to 127
SCAN-BRD2 (Address 2Ah) 128 to 191
SCAN-BRD3 (Address 2Bh) 192 to 255
11SCAN-BRD0 (Address 2Ch) 0 to 63
SCAN-BRD1 (Address 2Dh) 64 to 127
SCAN-BRD2 (Address 2Eh) 128 to 191
SCAN-BRD3 (Address 2Fh)192 to 255
2-14Available Operations
Table 2-3. Virtual Boards and Logical Channels (cont.)
Virtual
BoardSCAN-BRD Assemblies
12SCAN-BRD0 (Address 30h)0 to 63
SCAN-BRD1 (Address 31h)64 to 127
SCAN-BRD2 (Address 32h)128 to 191
SCAN-BRD3 (Address 33h)192 to 255
13SCAN-BRD0 (Address 34h)0 to 63
SCAN-BRD1 (Address 35h)64 to 127
SCAN-BRD2 (Address 36h)128 to 191
SCAN-BRD3 (Address 37h)192 to 255
14SCAN-BRD0 (Address 38h)0 to 63
SCAN-BRD1 (Address 39h)64 to 127
SCAN-BRD2 (Address 3Ah) 128 to 191
SCAN-BRD3 (Address 3Bh) 192 to 255
15SCAN-BRD0 (Address 3Ch) 0 to 63
SCAN-BRD1 (Address 3Dh) 64 to 127
Logical
Channels
SCAN-BRD2 (Address 3Eh) 128 to 191
SCAN-BRD3 (Address 3Fh)192 to 255
For each virtual board, you can determine the logical channel number
corresponding to a particular physical channel number by using the
following equation:
LogicalChn#PhysicalChan#64SCAN-BRD#×()+=
Analog Input Operations2-15
where
PhysicalChan# is an integer from 0 to 63 that indicates the physical
channel number on the SCAN-BRD assembly specified by SCAN-BRD#,
and
SCAN-BRD# is an integer from 0 to 3 that indicates on which
SCAN-BRD assembly the physical channel is located (0 indicates the first
SCAN-BRD assembly associated with the virtual board, 1 indicates the
second SCAN-BRD assembly associated with the virtual board, 2
indicates the third SCAN-BRD assembly associated with the virtual
board, and 3 indicates the fourth SCAN-BRD assembly associated with
the virtual board).
For example, the logical channel that identifies physical channel 15 on
SCAN-BRD2 (the third SCAN-BRD assembly associated with the virtual
board) is determined as follows:
LogicalChan#15642×()+15128+143===
By using a combination of the virtual board number and the logical
channel number in software, you can uniquely identify each channel in
your DAS-Scan system. For example, assume you have eight
SCAN-BRD assemblies connected to your SCAN-AD-HR board.
Physical channel number 51 on the fourth SCAN-BRD assembly
(SCAN-BRD3, Address 3) is identified as virtual board 0, logical
channel 243 (51 + (64 x 3)); physical channel 51 on the eighth
SCAN-BRD assembly (SCAN-BRD3, Address 7) is identified as virtual
board 1, logical channel 243.
Note: In the configuration file, the SCAN-BRD assemblies are addressed
sequentially from 0h to 3Fh (0 to 63 decimal), as shown in Table 2-3.
However, for the purposes of determining the logical channel number,
always use the number of the SCAN-BRD assembly in relation to a
virtual board (0, 1, 2, or 3).
2-16Available Operations
Specifying a Single Channel
For a single-mode analog input operation, you can acquire a single
sample from a single logical channel. Use the K_ADRead function to
specify the virtual board, the logical channel, and the gain code.
For a DMA-mode analog input operation, you can acquire a single
sample or multiple samples from a single logical channel. Use the
K_SetChn function to specify the logical channel and the K_SetG
function to specify the gain code.
Refer to Table 2-2 on page 2-11 for a list of the analog input ranges
supported by the DAS-Scan system and the gain code associated with
each range.
Note: If you are measuring steady-state signals, you can reduce the
effects of noise by performing a separate DMA-mode operation on each
logical channel and then averaging the results of each operation. For
example, you can perform one DMA-mode operation in which you
acquire 1,000 samples from logical channel 0 at a gain of 1 and another
DMA-mode operation in which you acquire 2,000 samples from logical
channel 1 at a gain of 200.
Specifying a Group of Consecutive Logical Channels
For a DMA-mode analog input operation, you can acquire samples from a
group of up to 256 consecutive logical channels associated with the same
virtual board. Use the K_SetStartStopChn function to specify the first
and last logical channels. The channels are sampled in order from first to
last.
The first logical channel can be higher than the last logical channel. For
example, if the first logical channel is 255 and the last logical channel is
2, your program reads data first from logical channel 255, then from
logical channels 0, 1, and 2.
Use the K_SetG function to specify the gain code for all logical channels
in the group. (All logical channels must use the same gain code.) Use the
K_SetStartStopG function to specify the gain code, the first logical
channel, and the last logical channel in a single function call.
Analog Input Operations2-17
Refer to Table 2-2 on page 2-11 for a list of the analog input ranges
supported by the DAS-Scan system and the gain code associated with
each range.
Note: If you are measuring temperature with a SCAN-BRD-TC or
SCAN-BRD-TC-ISO assembly , you can use physical channels 31 and 63
as CJC sensors to measure the temperature of the screw terminals. If you
enable a CJC channel, the CJC channel should be read at a gain of 1.
Unless you intend to read all your channels at a gain of 1, you must either
disable the CJC channels or specify your measurement channels in a
channel-gain queue. Refer to the next section for information about
channel-gain queues.
Specifying Channels in a Channel-Gain Queue
For a DMA-mode analog input operation, you can use a hardware
channel-gain queue to acquire samples from up to 256 logical channels
associated with the same virtual board. You specify the logical channels
you want to sample, the order in which you want to sample them, and a
gain code for each logical channel.
You can set up the logical channels in a channel-gain queue either in
consecutive order or in nonconsecutive order. You can also specify the
same logical channel more than once. The channels are sampled in order
from the first logical channel in the queue to the last logical channel in the
queue.
Refer to Table 2-2 on page 2-11 for a list of the analog input ranges
supported by the DAS-Scan system and the gain code associated with
each range.
The way that you specify the logical channels and gains in a channel-gain
queue depends on the language you are using. Refer to the DAS-Scan
Function Call Driver online help file (SCANFCD.HLP) for
language-specific information.
After you create the channel-gain queue in your program, use the
K_SetChnGAry function to specify the staring address of the
channel-gain queue.
2-18Available Operations
Notes: The throughput of the DAS-Scan system is reduced when using a
channel-gain queue, particularly when the SCAN-AD-HR board must
switch the gain between each logical channel. Therefore, it is
recommended that you keep all logical channels you are reading at a
particular gain together, even if you must arrange the channels out of
sequence.
For example, assume that you are measuring temperature on a
SCAN-BRD-TC or SCAN-BRD-TC-ISO assembly and you are using
physical channels 31 and 63 as CJC sensors to measure the temperature of
the screw terminals. Since the CJC channels should be read at a gain of 1,
arrange the channel-gain queue so that you read all the measurement
channels first and then read the CJC channels. Example program 4,
provided in the ASO-SCAN software package, illustrates the use of a
channel-gain queue with the CJC channels enabled.
If you are not using all 256 logical channels on a virtual board, you can
allow for settling time by specifying the same logical channel twice and
then ignoring the reading from the first logical channel.
If you are not using all 256 logical channels on a virtual board, you can
reduce the effects of noise by specifying the same logical channel
multiple times and then averaging the readings from each channel. For
example, you can specify logical channel 0 for the first five entries in the
channel-gain queue, logical channel 1 for the next five entries, and so on.
Pacer Clock
For a DMA-mode operation, you can use a pacer clock to determine the
period between the conversion of one logical channel and the conversion
of the next logical channel in a scan of multiple logical channels. You can
specify an internal or an external pacer clock, as described in the
following sections.
Analog Input Operations2-19
Notes: The rate at which the computer can reliably read data from the
SCAN-AD-HR board depends on a number of factors, including your
computer, the operating system/environment, the types of SCAN-BRD
assemblies you are using, the gains of the channels, and other software
issues. If your data appears to be invalid, you may have to use a slower
clock rate. Refer to the DAS-Scan User’s Guide for the maximum
throughput rates supported for each SCAN-BRD assembly at each gain.
T ypically, using the pacer clock to control the period between conversions
of individual logical channels in a scan is sufficient; this is referred to as
paced conversion mode. However, if you are acquiring data from 256
logical channels or fewer , you can use both the pacer clock (to control the
period between individual logical channels in a scan) and the burst mode
conversion clock (to control the period between conversions of the entire
scan); this is referred to as burst conversion mode. Refer to page 3-25 for
more information about specifying burst conversion mode. Refer to page
3-26 for more information about using the burst mode conversion clock.
Internal Pacer Clock
The internal pacer clock uses two cascaded counters of the counter/timer
circuitry on the SCAN-AD-HR board. The counters are normally in an
idle state. When you start the analog input operation (using
K_DMAStart), a conversion is initiated. Note that a slight time delay
occurs between the time the operation is started and the time the
conversion is initiated.
After the first conversion is initiated, the counters are loaded with a count
value and begin counting down. When the counters count down to 0,
another conversion is initiated and the process repeats.
Because the counters use a 5 MHz time base, each count represents
0.2
µs. Use the K_SetClkRate function to specify the number of counts
(clock ticks) between conversions. For example, if you specify a count of
300, the period between conversions is 60
µs (16.67 ksamples/s); if you
specify a count of 87,654, the period between conversions is 17.53 ms
(57 samples/s).
2-20Available Operations
You can specify a count value from 50 (100 kHz) to 4,294,836,255
(0.0012 Hz). The period between conversions ranges from 10
µs to
14.3 minutes.
When using an internal pacer clock, use the following formula to
determine the number of counts to specify:
For example, if you want a conversion rate of 10 ksamples/s, specify a
count of 500, as shown in the following equation:
If you want to use the same conversion rate for all the virtual boards in
your DAS-Scan system, call K_SetClkRate once for each virtual board
and specify the same number of counts for each.
The internal pacer clock is the default pacer clock. To reset the pacer
clock source to the internal pacer clock, use the K_SetClk function. (If
you want to reset all the virtual boards in your DAS-Scan system to use
the internal pacer clock, call K_SetClk once for each virtual board and
specify the internal pacer clock for each.)
External Pacer Clock
You connect an external pacer clock to the J5 connector on the
SCAN-AD-HR board. When you start an analog input operation (using
K_DMAStart), conversions are armed. At the next active edge of the
external pacer clock (and at every subsequent active edge of the external
pacer clock), a conversion is initiated.
Use the K_SetClk function to specify an external pacer clock. Then, use
the K_SetExtClkEdge function to specify the active edge (rising or
falling) of the external pacer clock. A falling edge is the default active
edge.
If you are using an external pacer clock, make sure that the clock initiates
conversions at a rate that the analog-to-digital converter can handle.
Analog Input Operations2-21
Triggers
If you want to use an external pacer clock source for all the virtual boards
in your DAS-Scan system, call K_SetClk once for each virtual board and
specify an external pacer clock for each. If you want to use the same
active edge for all the virtual boards in your DAS-Scan system, call
K_SetExtClkEdge once for each virtual board and specify the same
active edge for each.
Note:
You cannot use an external pacer clock if you are using either an
external digital trigger or a hardware gate.
A trigger is an event that occurs based on a specified set of conditions. If
you are performing DMA-mode analog input operations on a series of
virtual boards, you can specify a start trigger for the first virtual board to
determine when acquisitions start.
The start trigger can be an internal trigger or an external digital trigger, as
described in the following sections.
The trigger event is not significant until the operation has been started
(using K_DMAStart ). The point at which conversions begin relative to
the trigger event depends on the pacer clock; refer to page 2-19 for more
information.
Note:
this is referred to as post-trigger acquisition. However, if you are
performing a DMA-mode operation and acquiring data from 256 logical
channels or fewer, you can also use an optional second trigger, the about
trigger, to acquire data before the trigger event occurs (referred to as
pre-trigger acquisition) or both before and after the trigger event occurs
(referred to as about-trigger acquisition). Refer to page 3-26 for more
information about specifying pre-trigger acquisition. Refer to page 3-28
for more information about specifying about-trigger acquisition.
2-22Available Operations
Typically, you want to acquire data after the trigger event occurs;
Internal T rigger
An internal trigger is a software trigger. The trigger event occurs when
you start the operation. Note that a slight delay occurs between the time
you start the operation and the time the trigger event occurs.
If you want to use an internal start trigger, specify an internal trigger for
all the virtual boards in your DAS-Scan system.
The internal trigger is the default trigger source. To reset the trigger
source to an internal trigger, use the K_SetTrig function.
External Digital Trigger
An external digital trigger event occurs when an active edge is detected
on the digital trigger signal connected to the J5 connector on the
SCAN-AD-HR board.
Use the K_SetTrig function to specify an external trigger. Then, use the
K_SetDITrig function to specify whether you want the trigger event to
occur on a rising edge (positive-edge trigger) or on a falling edge
(negative-edge trigger). The trigger conditions are illustrated in
Figure 2-2.
If you want to use an external digital start trigger, specify an external
trigger (using K_SetTrig ) and call K_SetDITrig for the first virtual
board only. For all subsequent virtual boards, use K_SetTrig to specify
an internal trigger and do not call K_SetDITrig .
Analog Input Operations2-23
Note:
external pacer clock or a hardware gate.
Hardware Gate
A hardware gate is an externally applied digital signal that determines
when conversions can occur. You connect the gate signal to the J5
connector on the SCAN-AD-HR board.
If you start a DMA-mode analog input operation (using K_DMAStart )
and the hardware gate is enabled, the state of the gate signal determines
whether conversions occur, as follows:
●
●
Use the K_SetGate function to enable and disable a hardware gate and to
specify the gate polarity (positive or negative).
You cannot use an external digital trigger if you are using either an
If you specify a positive gate, conversions occur only if the signal to
the J5 connector is high; if the signal to the J5 connector is low,
conversions are inhibited.
If you specify a negative gate, conversions occur only if the signal to
the J5 connector is low; if the signal to the J5 connector is high,
conversions are inhibited.
If you want to use a hardware gate for all the virtual boards in your
DAS-Scan system, call K_SetGate once for each virtual board and
specify the same polarity for each.
The default state of the hardware gate is disabled. If you enable a
hardware gate for all the virtual boards in your DAS-Scan system and
later want to disable the hardware gate, call K_SetGate once for each
virtual board and specify disabled for each.
You cannot use a hardware gate if you are using either an external
Note:
pacer clock or an external digital trigger.
2-24Available Operations
3
Additional Features
This chapter contains conceptual information about additional features of
the DAS-Scan Function Call Driver. It includes the following sections:
Summary of Additional Functions - a brief description of the
●
additional DAS-Scan Function Call Dri v er functions that you can use
when reading 256 logical channels or fewer or when performing an
interrupt-mode analog input operation.
●
Additional Programming Flow Diagrams - an illustration of the
procedures to follow when using all of the DAS-Scan Function Call
Driver functions.
●
Performing an Interrupt-Mode Operation - information on
performing an interrupt-mode analog input operation.
●
Specifying Continuous Mode - information on specifying
continuous buffering mode.
●
Reserving Large or Multiple Memory Buffers - information on
dynamically allocating a large memory buffer or dynamically
allocating multiple memory buffers.
●
Specifying Burst Mode - information on specifying burst conv ersion
mode.
●
Using the Burst Mode Conversion Clock - information on using the
burst mode conversion clock to acquire data in burst mode.
●
Specifying Pre-T rigger Acquisition - information on using the about
trigger to acquire data before a trigger event occurs.
Specifying About-T rigger Acquisition - information on using the
●
about trigger to acquire data both before and after a trigger event
occurs.
3-1
Summary of Additional Functions
Table 3-1 describes the additional functions in the DAS-Scan Function
Call Driver that you can use when reading 256 logical channels or fewer
or when performing an interrupt-mode analog input operation. For more
detailed information about the functions, refer to the information in this
chapter beginning on page 3-19 and to the DAS-Scan Function Call
Driver online help file (SCANFCD.HLP).
Table 3-1. Summary of Additional Functions
Type of Function Name of FunctionDescription
OperationK_IntStartStarts an interrupt-mode operation.
K_IntStatusGets the status of an interrupt-mode operation.
K_IntStopStops an interrupt-mode operation.
Memory
management
Buffer addressK_SetBufSpecifies a local array (C/C++) or a
K_IntAllocDynamically allocates a memory buffer for an
interrupt-mode operation.
K_IntFreeFrees a memory buffer that was dynamically
allocated for an interrupt-mode operation.
dynamically allocated memory buffer (C/C++
or Visual Basic for Windows) for an
interrupt-mode operation.
K_SetBufISpecifies a local array (Visual Basic for
Windows) for an interrupt-mode operation.
K_BufListAddAdds a buffer or array to the list of multiple
buffers or arrays.
K_BufListResetClears the list of multiple buffers or arrays.
K_ClrContRunSpecifies single-cycle mode.
Conversion modeK_SetADFreeRunSpecifies burst mode.
K_ClrADFreeRunSpecifies paced mode.
3-2Additional Features
Table 3-1. Summary of Additional Functions (cont.)
Type of Function Name of FunctionDescription
ClockK_SetBurstTicksSpecifies the burst mode conversion rate.
K_GetBurstTicksGets the burst mode conversion rate.
TriggerK_SetAboutTrigEnables the about trigger and specifies the
number of post-trigger samples.
K_ClrAboutTrigDisables the about trigger.
Additional Programming Flow Diagrams
This section contains a series of programming flow diagrams illustrating
the procedures to follow when using all of the DAS-Scan Function Call
Driver functions. 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.
Additional Programming Flow Diagrams3-3
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
3-4Additional Features
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
Additional Programming Flow Diagrams3-5
Steps for an Interrupt-Mode Analog Input Operation
Access a frame for a virtual board
(K_GetADFrame)
Scanning
256 channels
or fewer?
No
Using a
dynamically
allocated
memory
buffer?
No
Declare and dimension
a local array
Specify the starting address of
the local array
(K_SetBuf for C/C++,
K_SetBufI for Visual Basic)
Yes
Yes
Using
multiple
buffers or
arrays?
No
Allocate a buffer
(K_IntAlloc)
Specify the
starting address
of the buffer
(K_SetBuf)
Yes
dynamically
allocated
Declare and
dimension
each local array
Add each array to the
list of multiple arrays
(K_BufListAdd)
Using
memory
buffers?
No
Yes
Allocate each buffer
Add each buffer
multiple buffers
(K_BufListAdd)
(K_IntAlloc)
to the list of
Continued on next page
3-6Additional Features
Steps for an Interrupt-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
Yes
Define the
channel-gain
queue
Using
Visual
Basic?
No
(K_SetChnGAry)
Yes
Specify the first and last channels
and the gain for all channels
K_SetStartStopChn and K_SetG)
Format the
channel-gain queue
(K_FormatChnGAry)
Modify the
channel-
gain
queue?
(K_SetStartStopG or
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
Additional Programming Flow Diagrams3-7
Steps for an Interrupt-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)
Scanning
256 channels
or fewer?
Yes
No
Yes
No
Set the clock rate
(K_SetClkRate)
Using
paced
mode?
Specify burst conversion mode
(K_SetADFreeRun)
Set the burst mode conversion rate
(K_SetBurstTicks)
Yes
No
Specify paced conversion mode
(K_ClrADFreeRun)
Specify the buffering mode
(K_SetContRun for continuous mode,
K_ClrContRun for single-cycle mode)
Continued on next page
3-8Additional Features
Steps for an Interrupt-Mode Analog Input Operation (cont.)
Continued from previous page
Using an
external
digital start
trigger?
No
Specify an internal
start trigger
(K_SetTrig)
Using a
hardware
gate?
No
Disable the gate
(K_SetGate)
Yes
Yes
Specify an external start trigger
(K_SetTrig)
Specify the digital
trigger conditions
(K_SetDITrig)
Specify the gate polarity
(K_SetGate)
Setting up
another
virtual board?
No
Continued on next page
Yes
Access a frame for the virtual board;
go to the top of page 3-6
Additional Programming Flow Diagrams3-9
Steps for an Interrupt-Mode Analog Input Operation (cont.)
Continued from previous page
Start the interrupt-mode operation
(K_IntStart)
Monitor the status of the operation
(K_IntStatus)
Scanning
256 channels
or fewer?
No
Scanning
another
virtual
board?
No
Continued on next page
Yes
Yes
Using
continuous
buffering
mode?
No
Yes
Stop the operation
(K_IntStop)
3-10Additional Features
Steps for an Interrupt-Mode Analog Input Operation (cont.)
Continued from previous page
Using
dynamically
allocated
buffers?
No
Read data
from each array
Convert data
from each array
Scanning
256 channels
or fewer?
Yes
Yes
Using
Visual
Basic?
No
Read data
from each buffer
Convert data
from each buffer
Free each buffer
(K_IntFree)
Using
multiple buffers
or arrays?
Yes
Transfer data from each
buffer to a local array
(K_MoveBufToArray)
Read data
from each array
Convert data
from each array
Yes
Clear list of multiple
buffers or arrays
(K_BufListReset)
No
Free each frame
Operation complete
No
Additional Programming Flow Diagrams3-11
Steps for a DMA-Mode Analog Input Operation
Access a frame for a virtual board
(K_GetADFrame)
Scanning
256 channels
or fewer?
No
Allocate a buffer
(K_DMAAlloc)
Specify the starting address
of the buffer
(K_SetDMABuf)
Continued on next page
Yes
Using
multiple
memory
buffers?
No
Yes
Allocate each buffer
(K_DMAAlloc)
Add each buffer to list
of multiple buffers
(K_BufListAdd)
3-12Additional Features
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
Visual
Basic?
(K_SetChnGAry)
Yes
queue
Using
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
Additional Programming Flow Diagrams3-13
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)
Scanning
256 channels
or fewer?
Yes
No
Yes
Set the clock rate
(K_SetClkRate)
Using
paced
mode?
Specify burst conversion mode
(K_SetADFreeRun)
Set the burst mode conversion rate
(K_SetBurstTicks)
Yes
No
Specify paced conversion mode
(K_ClrADFreeRun)
Specify the buffering mode
(K_SetContRun for continuous mode,
K_ClrContRun for single-cycle mode)
Continued on next page
3-14Additional Features
Steps for a DMA-Mode Analog Input Operation (cont.)
Continued from previous page
Using an
external
digital start
trigger?
No
Specify an internal start trigger
(K_SetTrig)
Scanning
256 channels
or fewer?
No
Yes
Yes
Specify an external start trigger
(K_SetTrig)
Specify digital
trigger conditions
(K_SetDITrig)
Using
post-trigger
acquisition?
Using
pre-trigger
acquisition?
Yes
(K_ClrAboutTrig)
No
Yes
(K_SetAboutTrig)
No
Disable the
about trigger
Enable the
about trigger
and specify
1 sample
Enable the
about trigger
and specify
the number of
post-trigger
samples
(K_SetAboutTrig)
Using an
internal start
trigger?
No
Continued on next page
Yes
Specify active
edge of the
about trigger
(K_SetDITrig)
Additional Programming Flow Diagrams3-15
Steps for a DMA-Mode Analog Input Operation (cont.)
Continued from previous page
Using a
hardware
gate?
No
Disable the gate
(K_SetGate)
Setting up
another
virtual board?
No
Continued on next page
Yes
Yes
Specify the gate polarity
(K_SetGate)
Access a frame for the virtual board;
go to the top of page 3-12
3-16Additional Features
Steps for a DMA-Mode Analog Input Operation (cont.)
Continued from previous page
Start the DMA-mode operation
(K_DMAStart)
Monitor the status of the operation
(K_DMAStatus)
Scanning
256 channels
or fewer?
No
Scanning
another
virtual
board?
No
Continued on next page
Yes
Yes
Using
continuous
buffering
mode?
No
Yes
Stop the operation
(K_DMAStop)
Additional Programming Flow Diagrams3-17
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)
Scanning
256 channels
or fewer?
Yes
Transfer data from each
buffer to a local array
(K_MoveBufToArray)
Read data
from each array
Convert data
from each array
Yes
Using
multiple buffers
or arrays?
Yes
Clear list of multiple
buffers or arrays
(K_BufListReset)
No
Free each frame
Operation complete
No
3-18Additional Features
Performing an Interrupt-Mode Operation
If DMA resources are not available, you can perform an analog input
operation in interrupt mode. In interrupt mode, the SCAN-AD-HR board
acquires a single sample or multiple samples from one or more logical
channels (up to a maximum of 256) on the same virtual board. 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 FIFO on the SCAN-AD-HR
board and then transfers the data to a user-defined buffer in computer
memory using an interrupt service routine.
Use the K_IntStart function to start the interrupt-mode operation on the
first virtual board, specifying the handle of the frame that defines the first
operation. After the SCAN-AD-HR board reads a sample from each
logical channel associated with the virtual board and stores the samples in
the user-defined buffer, the operation stops. (Use the K_IntStatus
function to monitor the status of the operation and determine when the
operation stops.) Then, use K_IntStart again to start the interrupt-mode
operation on the next virtual board, specifying the handle of the frame
that defines the next operation.
Refer to page 3-6 for the procedure to follow when performing an
interrupt-mode operation. In addition, example program 1, provided in
the ASO-SCAN software package, illustrates how to acquire data in
interrupt mode.
The data in the user-defined buffer is stored as count values. Refer to
Appendix A for information on converting the count value to voltage or
degrees.
Performing an Interrupt-Mode Operation3-19
Notes:
operation and start another, a slight delay occurs before the DAS-Scan
system begins acquiring data on each subsequent virtual board.
Typically, you want your interrupt-mode operation to stop automatically
after one sample from each logical channel has been read; this is referred
to as single-cycle buffering mode. However, like DMA mode, if you are
acquiring data from 256 logical channels or fewer, you can also perform
the operation in continuous buffering mode. Continuous buffering mode
allows you to continuously acquire data, overwriting any values already
stored in memory. Refer to page 3-23 for more information.
In most cases, the information in Chapter 2 that applies to a DMA-mode
operation also applies to an interrupt-mode operation. The following
sections describe additional considerations and exceptions to keep in
mind when performing an interrupt-mode operation.
Accessing a Frame
Like a DMA-mode operation, an interrupt-mode operation requires an
A/D frame. Refer to page 2-7 for information about accessing a frame.
Because of the overhead required to stop one interrupt-mode
For interrupt mode, use the K_IntStart function (instead of the
K_DMAStart function) to start the operation you set up.
Reserving Memory
Like a DMA-mode operation, an interrupt-mode operation requires
memory in which to store the acquired data. The recommended way to
reserve memory for an interrupt-mode operation is to dynamically
allocate a memory buffer for each virtual board. Refer to page 2-9 for
more information.
For interrupt mode, use the K_IntAlloc function (instead of the
K_DMAAlloc function) to allocate the buffer. When you no longer
require the buffer, use the K_IntFree function (instead of the
K_DMAFree function) to free the buffer for another use.
3-20Additional Features
Notes:
If you dynamically allocate a buffer of 256 samples (the typical
size), an interrupt is generated after each sample and the samples are
transferred one-by-one from the FIFO to the user-defined buffer in
computer memory. If your computer cannot service interrupts fast
enough, a FIFO overflow error may occur. If you dynamically allocate a
buffer of 512 samples (half of a FIFO), or any multiple of 512 samples, an
interrupt is generated after 512 samples are acquired and the entire block
of 512 samples is transferred from the FIFO to the user-defined buffer in
computer memory. To optimize an interrupt-mode operation, make sure
that the size of your buffer is a multiple of 512 samples.
If you are writing Windows 95, 32-bit programs, you must install the
Keithley Memory Manager. Refer to the DAS-Scan User’s Guide for
information.
For interrupt mode, in addition to reserving memory by dynamically
allocating a buffer, you can reserve memory by dimensioning an array
within your application program’s memory area for each virtual board. A
local array is directly accessible to your application program; for Visual
Basic For Windows, you do not have to use the K_MoveBufToArray
function to move the data from the dynamically allocated buffer to the
program’s local array. However, unlike dynamically allocated buffers,
which can be freed to make them available to other programs or
processes, local arrays occupy permanent memory areas and cannot be
freed. In addition, you cannot use local arrays with Windows 95, 32-bit
programs.
Typically, a single array or buffer that can hold one sample for each
logical channel associated with the virtual board is sufficient. However,
like DMA mode, if you are acquiring data from 256 logical channels or
fewer, you can dimension a larger array/buffer or multiple arrays/buffers
(up to a maximum of 150), allowing you to sample each logical channel
multiple times. Use the K_IntAlloc function to dynamically allocate a
memory buffer of up to 5,000,000 samples.
Performing an Interrupt-Mode Operation3-21
If you are using large or multiple dynamically allocated memory buffers,
you may be limited in the amount of memory you can allocate. It is
recommended that you install the Keithley Memory Manager before you
begin programming to ensure that you can allocate a large enough buffer
or buffers. Refer to the DAS-Scan User’s Guide for more information
about the Keithley Memory Manager.
Table 3-2 lists the functions used in interrupt mode to assign the starting
addresses of local arrays or dynamically allocated buffers and to specify
the number of samples to store in the buffers or arrays.
Table 3-2. Functions Used to Assign Starting Addresses
in Interrupt Mode
LanguageType of Arrays or BuffersFunction
C/C++Single local arrayK_SetBuf
Multiple local arraysK_BufListAdd
Single dynamically allocated bufferK_SetBuf
Multiple dynamically allocated buffersK_BufListAdd
Visual Basic
for Windows
Single local arrayK_SetBufI
Multiple local arraysK_BufListAdd
Single dynamically allocated bufferK_SetBuf
Multiple dynamically allocated buffersK_BufListAdd
Specifying Channels and Gains
Like a DMA-mode operation, for an interrupt-mode operation, you can
specify the logical channels on which to perform the operation and the
gain at which to read the logical channels. Refer to page 2-11 for
information about specifying the gain; refer to page 2-12 for information
about specifying the logical channels.
3-22Additional Features
Specifying a Pacer Clock
Like a DMA-mode operation, for an interrupt-mode operation, you can
use a pacer clock to determine the period between the conversion of one
logical channel and the conversion of the ne xt logical channel in a scan of
multiple logical channels. Refer to page 2-19 for more information.
Typically, using the pacer clock alone is sufficient. However, like DMA
mode, if you are acquiring data from 256 logical channels or fewer, you
can use both the pacer clock and the burst mode conversion clock to
perform your operation in burst conversion mode. Refer to page 3-25 for
more information about specifying burst conversion mode. Refer to page
3-26 for more information about using the burst mode conversion clock.
Specifying a Trigger
Like a DMA-mode operation, for an interrupt-mode operation, you can
specify a start trigger for the first virtual board to determine when
acquisitions start. Refer to page 2-22 for more information.
Note that unlike DMA mode, in interrupt mode, you cannot use the about
trigger to perform pre-trigger or about-trigger acquisitions.
Enabling a Hardware Gate
Like a DMA-mode operation, for an interrupt-mode operation, you can
enable a hardware gate to determine when conv ersions can occur . Refer to
page 2-24 for more information.
Specifying Continuous Mode
If you are reading 256 logical channels or fewer, you can specify
continuous buffering mode. In continuous mode, the SCAN-AD-HR
board continuously converts samples and stores them in memory until it
receives a stop function. Any values already stored in memory are
overwritten. Use the K_SetContRun function to specify continuous
buffering mode.
Specifying Continuous Mode3-23
If you specify the logical channels you want to read in either a group of
consecutive logical channels or in a channel-gain queue, the specified
channels are continuously sampled until the specified number of samples
is read. For example, in a group of consecutive logical channels, the first
logical channel is 14, the last logical channel is 17, and you want to
acquire five samples. Your program reads data first from logical channel
14, then from logical channels 15, 16, and 17, and finally from logical
channel 14 again.
Notes:
virtual board and later want to reset the buffering mode to single-cycle
mode, use the K_ClrContRun function. In single-cycle mode, after the
SCAN-AD-HR board converts one sample from each logical channel on
the virtual board and stores the samples in memory, the operation stops
automatically.
You cannot use continuous mode if you enable the generation of
Windo ws ev ents. Refer to page 2-3 for more information about generating
a Windo ws event.
If you specify continuous buffering mode for an operation on a
Reserving Large or Multiple Memory Buffers
Reserving a large memory buffer or multiple memory buffers is useful if
you want to read each logical channel on a virtual board multiple times to
average the data read from the channels.
If you are performing a DMA-mode analog input operation and you are
reading 256 logical channels or fewer, you can use the K_DMAAlloc
function to dynamically allocate a memory buffer of up to 65,536
samples. You can also dynamically allocate multiple memory buffers (up
to a maximum of 150).
If you are using large or multiple dynamically allocated memory buffers,
you may be limited in the amount of memory you can allocate. It is
recommended that you install the Keithley Memory Manager before you
begin programming to ensure that you can allocate a large enough buffer
or buffers. Refer to the DAS-Scan User’s Guide for more information
about the Keithley Memory Manager.
3-24Additional Features
Use the K_SetDMABuf function to assign the starting address of a single
dynamically allocated buffer.
Use the K_BufListAdd function to assign the starting addresses of
multiple dynamically allocated buffers. Use the K_BufListReset
function to clear the list of multiple buffers or arrays when you are
through with them.
Specifying Burst Mode
If you are reading 256 logical channels or fewer, you can specify burst
conversion mode. Burst mode is useful if you w ant a single external e v ent
(such as the pulse of an external pacer clock) to start conv ersions of all the
channels in a scan.
In burst mode, you use both the pacer clock and the burst mode
conversion clock. The pacer clock determines the period between the
conversions of one scan and the conversions of the next scan; the burst
mode conversion clock determines the period between the conversion of
one logical channel in a scan and the conversion of the next logical
channel in the scan. Refer to page 2-19 for information about the pacer
clock; refer to the next section for information about the burst mode
conversion clock. Use the K_SetADFreeRun function to specify burst
mode.
Notes:
board includes SCAN-BRD-V-ISO or SCAN-BRD-TC-ISO isolated
assemblies.
If you specify burst conversion mode for an operation on a virtual board
and later want to reset the conversion mode to paced mode, use the
K_ClrADFreeRun function. In paced mode, the pacer clock determines
the period between the conversion of one logical channel in a scan and the
conversion of the next logical channel in the scan.
It is recommended that you do not use burst mode if a virtual
Specifying Burst Mode3-25
Using the Burst Mode Conversion Clock
If you are reading 256 logical channels or fewer in burst conversion
mode, you use the burst mode conversion clock to determine the period
between the conversion of one logical channel in a scan and the
conversion of the next logical channel in the scan.
Because the burst mode conversion clock uses a 1 MHz time base, each
clock tick represents 1
the number of clock ticks between conversions. For example, if you
specify 30 clock ticks, the period between conversions is 30
(33.33 ksamples/s).
You can specify from 10 clock ticks (100 kHz) to 64 clock ticks
(15.625 kHz). The period between conversions ranges from 10
64
µ
s.
µ
s. Use the K_SetBurstTicks function to specify
s
µ
µ
s to
When using the burst mode conversion clock, use the following formula
to determine the number of clock ticks to specify:
clock ticks
For example, if you want a burst mode conversion rate of 10 ksamples/s,
specify 100 clock ticks, as shown in the following equation:
If you are performing a DMA-mode analog input operation and you are
reading 256 logical channels or fewer , you can use pre-trigger acquisition
to acquire data before a specific trigger event.
3-26Additional Features
You specify both a start trigger and an about trigger. The start trigger
determines when acquisitions start on a virtual board and can be either an
internal trigger or an external digital trigger. The about trigger is always
an external digital trigger; acquisitions stop on the virtual board when the
about-trigger event occurs. Refer to page 2-23 for information about an
internal trigger; refer to page 2-23 for information about an external
digital trigger.
To specify pre-trigger acquisition, perform the following steps:
1. Specify the start trigger.
–Use K_SetTrig to specify an internal or an external trigger
source.
–If you specify an external start trigger in K_SetTrig , use
K_SetDITrig to specify the active edge for the digital trigger.
2. Use K_SetAboutTrig to enable the about trigger and to set the
number of samples to 1.
Note:
The minimum number of samples that you can specify in
K_SetAboutTrig is 1.
3. Specify the active edge for the about trigger, if necessary.
–If the start trigger is an internal trigger, use K_SetDITrig to
specify the active edge for the about trigger.
–If the start trigger is an external digital trigger, the active edge
used for the start trigger is also used for the about trigger. It is not
necessary to use K_SetDITrig again.
Notes:
If you specify pre-trigger acquisition for an operation on a virtual
board and later want to reset the operation for post-trigger acquisition, use
the K_ClrAboutTrig function to disable the about trigger.
Pre-trigger acquisition is not available with interrupt-mode operations.
Specifying Pre-Trigger Acquisition3-27
Specifying About-Trigger Acquisition
If you are performing a DMA-mode analog input operation and you are
reading 256 logical channels or fewer, you can use about-trigger
acquisition to acquire data both before and after a specific trigger event.
You specify both a start trigger and an about trigger. The start trigger
determines when acquisitions start on a virtual board and can be either an
internal trigger or an external digital trigger. The about trigger is always
an external digital trigger; acquisitions stop after a specified number of
samples has been acquired on the virtual board after the about-trigger
event occurs. Refer to page 2-23 for information about an internal trigger;
refer to page 2-23 for information about an external digital trigger.
To specify about-trigger acquisition, perform the following steps:
1. Specify the start trigger.
–Use K_SetTrig to specify an internal or an external trigger
source.
–If you specify an external start trigger in K_SetTrig , use
K_SetDITrig to specify the active edge for the digital trigger.
2. Use K_SetAboutTrig to enable the about trigger and to specify the
desired number of post-trigger samples.
3. Specify the active edge for the about trigger, if necessary.
–If the start trigger is an internal trigger, use K_SetDITrig to
specify the active edge for the about trigger.
–If the start trigger is an external digital trigger, the active edge
used for the start trigger is also used for the about trigger. It is not
necessary to use K_SetDITrig again.
Notes:
virtual board and later want to reset the operation for post-trigger
acquisition, use the K_ClrAboutTrig function to disable the about
trigger.
About-trigger acquisition is not available with interrupt-mode operations.
3-28Additional Features
If you specify about-trigger acquisition for an operation on a
A
Data Formats
This appendix contains the following sections:
Converting Counts to Voltage - instructions for converting a count
●
value returned by the DAS-Scan Function Call Driver to a voltage
value.
Converting Counts to Temperature - instructions for converting a
●
count value returned by the DAS-Scan Function Call Driver to a
temperature value.
Converting Counts to Voltage
The DAS-Scan Function Call Driver can read count values only. When
reading an analog input value (as in K_ADRead ), you can convert the
count value returned by the DAS-Scan Function Call Driver to a voltage
value. If you are using a SCAN-BRD-TC or SCAN-BRD-TC-ISO
assembly and want to express the value in degrees, you can then convert
the voltage value to a temperature value; refer to the next section for
information.
To convert an analog input value to a voltage, use the follo wing equation,
where count is the count value and span is the span in volts (refer to
T able A-1):
Voltage
countspan×
-------------------------------- -=
65536
Converting Counts to VoltageA-1
−
−
−
−
−
−
−
−
Table A-1. Span Values For Data Conversion Equations
Input Range
TypeGain
Unipolar10 to 10 V10
20 to 5 V5
40 to 2.5 V2.5
80 to 1.25 V1.25
500 to 0.2 V0.2
1000 to 0.1 V0.1
2000 to 50 mV0.05
4000 to 25 mV0.025
Bipolar1
2
4
8
50
100
Analog Input
Range
10 to 10 V20
5 to 5 V10
2.5 to 2.5 V5
1.25 to 1.25 V2.5
0.2 V to 0.2 V0.4
0.1 V to 0.1 V0.2
Span (V)
200
400
50 mV to 50 mV 0.1
25 mV to 25 mV 0.05
For example, assume that you want to read analog input data from a
channel configured for a bipolar input range type; the channel collects the
data at a gain of 2. The count value is 1024. The voltage is determined as
follows:
102410× V
------------------------------0.156 V=
65536
A-2Data Formats
Converting Counts to Temperature
If you are using a SCAN-BRD-TC or SCAN-BRD-TC-ISO assembly,
you can convert the count value returned by the DAS-Scan Function Call
Driver to a temperature value. Refer to example program 4, provided in
the ASO-SCAN software package, as you perform the procedure
described in this section.
To convert a count value to a temperature value, perform the following
steps:
1. Convert the thermocouple count value returned by the DAS-Scan
Function Call Driver to thermocouple voltage. Refer to page A-1 for
information.
2. If you are using the CJC channels, convert the CJC count value
returned by the DAS-Scan Function Call Dri ver to CJC v oltage, using
a gain of 1. Refer to page A-1 for information.
3. Convert the CJC voltage to
and then convert the
Note:
Because the CJC sensors used on the DAS-Scan system
generate 10 mV per
°
K to
K, you must divide the CJC voltage by 0.010.
°
°
K by dividing the CJC voltage by 0.010,
°
C.
Converting Counts to TemperatureA-3
4. Adjust the thermocouple voltage to take into account the CJC
temperature value, using the appropriate intercept and slope values.
Notes:
The thermocouple voltage is a relative value, based on the
difference between the voltage at the end of the wire and the voltage
at the screw terminal panel; the CJC temperature is an absolute value.
You must first convert the CJC temperature to mV, based on the
thermocouple type you are using, and then add the two voltage values
together.
The intercept and slope values used in the example program assume
that the temperature of the CJC sensor is approximately 25
°
C. If the
temperature of your CJC sensor is different, use the appropriate
N.I.S.T thermocouple table to determine the appropriate intercept
value, and substitute an appropriate slope value.
5. Calculate the index into the thermocouple lookup table, using the
voltage step interval (mV) and starting voltage (mV) from the
[header] section of the appropriate table. Lookup tables for J, K, T, E,
R, S, and B type thermocouples are provided in the ASO-SCAN
software package.
6. Interpolate between the two nearest entries in the lookup table to
determine the true reading in
°
C.
A-4Data Formats
Index
A
A/D frame elements
about-trigger acquisition
accessing a frame
address of memory buffer
address of SCAN-BRD assembly
allocating memory
analog input operations
analog input range
Function Call Driver
DASSCAN_EventDisable
DASSCAN_EventEnable
data transfer modes: see operation modes
device handle
digital trigger
DMA mode
driver handle
driver: see Function Call Driver
2-2
2-23
1-9
2-1
,
2-5
,
3-12
2-3
2-3
C
channel
channel-gain queue
CJC
group of consecutive logical channels
2-12
2-18
,
3-22
2-19
,
2-17
2-18
E
elements of frame
error handling
2-3
event
external digital trigger
external pacer clock