Text preview for : 24404C(DAS40G1_252CG2).pdf part of Keithley 24404C(DAS40G1 252CG2) Keithley DAS 24404C(DAS40G1_252CG2).pdf
Back to : 24404C(DAS40G1_252CG2).pd | Home
DAS-40
Keithley Data Acquisition Keithley MetraBytdAsyst
0
0
0
User Guide
for the
DAS-40Gl & DAS-40G2
A/D & D/A Data Acquisition Boards
December 1992
Copyright
KEITHLEY DATA ACQUISITION - Kelthley MetraBytelAsyst
440 MYLES STANDISH BLVD.. Taunton. MA 02780
TEL. 508/880-3000. FAX 509/890-0179
11,
Warranty lnformatlon
AH products mnnufacturrd by Kcithlcy Data Acquisition ac warranted ngse~t
dcfcctivc malcrlals and workmanship lor a period of one year from the date of
delivcly to the orlglnnl purchnwr. Any pmduct that Is found to be defoctlvc within
the wiu-mnty pcrlod till. at the option al Keithley Data Acquisition, bc
rcpalrcd or rcplaccd. `IhIs warranty dots not apply to products damagud by
improper use.
Warning
Keithley Data Acquisition ~ssumcs no liability for damages coneequcnt
to the "SC of this product. Tb`s product I. not desI@,ned 4th components
of P level of reliability suitable for use in life support or critlca,
epplicetions.
iv
Contents
CHAPTER 1 INTRODUCTION
1.1 General . 1-l
1.2 Distribution Software l-l
1.3 The STA-40 Accessory 1-2
CHAPTER 2 INSTALLATION
2.1 General . . . . 2-1
2.2 Backing Up Distribution Software 2-1
Single-Floppy-Drive Machines 2-1
Dual-Floppy-Drive Machines 2-l
Hard-Drive Machines . . . . . 2-2
2.3 Unpacking & Inspecting . 2-2
2.4 Configuration Options. . . . 2-3
Base Address . . .2-3
DMA Channel 2-4
Interrupt Level . 2-5
A/D Functions 2-5
D/A Functions 2-6
2.5 Hardware installation . . . . 2-7
Single-Ended vs. Differential Connections 2-7
Installing The DAS-40 In A PC .2-e
2.6 DAS-40 & STA-40 I/O Connections 2-9
CHAPTER 3 PROGRAMMING NOTES
3.1 General .3-l
3.2 The Language Interlace Modules . 3-l
Interface For BASIC(A) - DAS4OBIN .3-3
Interlace For QuickBASIC - DAS40.LIB. DAS40.OLB. 3-3
3.3 Loading/Unloading The DAS-40 Softv!are Driver 3-4
3.4 Changing The Factory Configuration 3-5
3.5 The Call Modes 3-5
3.6 Default Configuration . . . . 3-6
3.7 Accommodating Multiple DAS-40s In A Single System .3-7
CHAPTER 4 CALL MODES
4.1 MODE 0: Query Configuration For An Installed DAS-40 .4-2
4.2 MODE 1: Specify Buffer(s) & Conversion Count(s) For ADC & DAC 4-2
4.3 MODE 2: Setup For A/D or D/A Conversions For Transfer Via DMA .4-4
4.4 MODE 3: Setup A/D Start/Stop Channels & Global Gain Value .4-6
4.5 MODE 4: Start A/D Conversions & Transfer Via DMA ,4-6
4.6 MODE 5: Stan D/A Conversions & Transfer Via DMA ,4-7
4.7 MODE 6: Setup A/D & D/A Conversion Pacing Clock .4-7
4.6 MODE 7: Do One A/D Conversion, .4-6
4.9 MODE 8: Do One D/A Conversion, .4-e
4.10 MODE 9: Monitor DMA Transfers For ADCs & DACs. ,4-9
4.11 MODE 10: Setup For Digital I10 4-9
4.12 MODE 11: Input Byte/Word . . ,4-9
4.13 MODE 12: Set/Query Current DAS-40 Card Number, 4-10
4.14 MODE 13: Terminate Current DMA Operation 4-10
4.15 MODE 14: Output Byte/Word . . . . . . 4-10
4.16 MODE 15: Tag Channel Numbers To A/D Data Sample. . 4-11
4.17 MODE 16: A/D Triggered Block Scan MODE (DMA) 4-12
4.18 MODE 17: Transfer Data To BASIC Array . . . . 4-12
4.19 MODE 18: Allocate Memory Buffer for DMA Operations. 4-13
4.20 MODE 19: Free Memory Buffer. . . 4-14
CHAPTER 5 REGISTER STRUCTURE & FORMAT
5.1 General. 5-l
5.2 A/D Control-Status Register (ADCSR) . 5-l
5.3 Channel-Gain List Control-Status Register (CHANCSR) 5-4
5.4 A/D Data Register (ADDAT). . . . . . . . . 5-6
5.5 D/A Control-Status Register (DACSR) 5-6
5.6 D/A Data Register (DADAT). . . . 5-9
5.7 DIO Data Register (DIODAT) . . 5-S
5.8 Supervisory Control-Status Register (SUPCSR) 5-10
5.9 Pacer Clock Register (TMRCTR) 5-14
CHAPTER 6 CALIBRATION
CHAPTER 7 SPECIFICATIONS
7.1 A/D Subsystem .
7.2 D/ASubsystem . .
7.3 Digital l/O Subsystem
7.4 External Trigger
7.5 Clock
7.6 Interface Characteristics
7.7 Power Requirements
7.8 Physical/Environmental
CHAPTER 8 FACTORY RETURNS
APPENDICES
Appendix A Coding Tables
Appendix B Direct Memory Access (DMA)
Appendix C Summary Of Error Codes
CHAPTER 1
INTRODUCTION
1 .l GENERAL
The DAS40Gl and DAS4OG2 arc high-speed, 12-bit, A/D and D/A data-acquisition boards that plug
into an accessory slot of an IBM PC-AT or compatibles. The two boards differ only in A/D gains and
throughputs. The Gl version offers gains of 1, 10, 103, and 500 at up to 100,CCU samples per scrond;
the G2 version offers gains of 1,2,4, and 8 with a throughput of 250,Mx) samples per second, see
specifications on Page 7-2. Analog input configuration is switch-selectable, and the board is
configurable for either eight differential input channels or 16 singlecndcd channels.
D/A subsections include two 12-bit, deglitched D/A converters able to provide cithcr single outputs
(the analog outputs change at different times) or simultaneous outputs (the D/A convcrtcr outputs
change at the same time). In a DMA (Direct Memory Access) transfer, digital data converts to analog
at 130KHz. The boards also feature two &?-linedigital I/O ports, which can bc set for input or output.
DAS40 models contain a programmable l'accr Clock for controlling A/D and D/A conversion rates.
Operating under program control, the Pacer Clock provides a usable range of 4.0~ (250KH.z) to 2s
(0.5Hz). External clocking may also be sclectcd for starting conversions, while an cxtcrnal trigger may
be selected for gating the conversions (A/D and D/A). The A/D and D/A converters can opcratc
simultaneously at the same clock speed, or the D/A subsystem can opcratc in single-conversion mode
while the A/D subsystem operates from the pacer clock or from an extcrnnl clock.
The DMA interface accommodates 16.bit data transfers and is switch-sclcctablc for DMA Chnnncl5,6,
or 7. DMA buffers can rcsidc anywhere in the DOS 640KB memory space of an PC/AT and may h
up to 65,536 words (128KB) each.
The boards are also configurable for using two DMA channels to support Continuous Performance
DMA. Continuous Performance DMA is a sampling method for providing gap-free transfers of large
volumes of data from memory or disk (D/A conversions) or to memory or disk (A/D conversions)
with no sample losses.
Interrupt Level support is jumper-selectable for Level 3,5,7,10, or 15. Analog-input voltage
protection extends to f25V with power On or Off.
Board calibration is pcrformcd at the factory. While calibration of the A/D subsystem changes very
little with a switch to a new range, the D/A subsystem may need recalibration for any range
switching.
1.2 DISTRIBUTION SOFTWARE
The software package furnished with your board includes an installable software driver, BASIC and
QuickBASIC Language Intcrfacc modules, example programs, and various utilities. Refer to the text
file FILES.DOC on your Distribution Software diskette for a complctc listing of the files contnincd
thereon.
1-1
DAS-40 USER GUIDE
1.3 THE STA-40 ACCESSORY
The STA-40 is a Screw Terminal Accessory Box useful for connecting to the DAS-40. All I/O
connections use screw terminals that are accessible through the side of the STA-40. Analog inputs
connect to Terminals TBl and TB2. Analog outputs, along with the external trigger and external clock,
connect to TB5. Digital port lines connect to TB3 and TB4. Five "user" lines and a +5V input line are
also available.
Two 50.pin connectors and a 26pin connector provide additional I/O interface Either 50.pin
connector accepts a cable from the DAS-40 while the other accepts one or several daisy-chained STA-
40s. The 2kpin connector is available for use with the "5802 Rack" of signal-conditioning modules.
When connecting an analog input to the STA-40 for a differential mcasurcmcnt, connect the input
signal line to a HI (High) terminal of Connector TBl or TB2 (HI0 through HI7 ) and the input
ground to corresponding L (Low) terminal f LO8 through L15 ). For cxamplc, a diffcrcntial
connection for Channel 0 would use HI0 and MB, while a differential connection for Channel 1
would USCHI1 and Log. Rcfcrcncc the ground of the DAS-40 to the system ground of the
mcasuremcnt source by connecting the AGND terminal either directly or via resistor to the system
ground.
When connecting an analog input to the STA40 for a singlccndcd mcasuremcnt, connect the input
signal lint to a HI (High) or L (Low) terminal (HI0 through H17 or LO8 through LJ5 ). For single-
ondcd mcasurcmcnts, the HI and L prefixes on TBl and TB2 have no significance. Connect the
analog input return to the terminal labelled ALO, which should be tied to the ground rcfcrcncc of
your system. If you want the ground rcfercncc to be at the STA40, connect the 2-way jumper of the
STA-40 ( WI ) to the LOCAL pin. If you want to rcferencc the analog inputs to a point in your
system, connect the W1 jumper to the REMOTE pin. For single-cndcd mcasurcmcnts, connect the
AGND terminal to your system ground, either directly or through a resistor to limit any common-
mode voltage bctwcen AL0 and AGND As a guard against a situation whew one might forget to
reference the system ground to DAS-40 ground, the DAS40 lOK-Ohm Resistor R30 (Figure 2-l)
connects AL0 to AGND You may remove this resistor if you use the REMOTE mcasurcmcnt
scheme.
Note that when you selecting Single-Ended or Diffcrcntial mcasurcments, rcmcmbcr to wt the DASJI)
sclcction switch.
The STA-40 also contains an area for brcadboarding an application circuit. The following patches are
available in that area:
PATCH DESCRII'TION
AGND Analog input ground return
+15v +15V fmtn the DAS-40 DC/DC Convcrtcr
-15v -15V from the DAS-40 DC/DC Converter
PGND Ground return for Al5V lines
DGND Digital ground return
+5v User-supplied input
USERA User-supplied input
USERB User-supplied input
USERC User-supplied input
USERD User-supplied input
USERE User-supplied input
NOTE: Limit the ?r15Voutput current to under 20mA.
1-2
CHAPTER 2
SETUP & INSTALLATION
2.1 GENERAL
This chapter provides instructions for the installing the DAS-40 in an IBM PC-AT or compatible. The
chapter begins with procedures for making working topics of your DA'S40 Distribution Softwarc.
Next arc instructions for unpacking and inspection, followed by descriptions of the options and
methods for setting all configurable parameters.
2.2 BACKING UP DISTRIBUTION SOFTWARE
Distribution software is furnished on 5.25", 360K floppy diskette(s). To accommodate users with 3.5"
floppy drive, the Software is also available on 720K diskette(s).
As soon as possible, make a working copy of your DAS-40 software using the procedures that follow.
Store your original software copy in a safe place as a backup.
The following back-up procedures cover the more common computer configurations: a single-floppy
drive (with hard disk), dual-floppy drives, and a hard drive.
Single-Floppy-Drive Machines
To copy your Distribution Software to your computer's hard disk, rcfcr to the subsection below
entitled Hard-DriveMachines To copy to another diskette in a single-floppy-drive machine (with
hard disk),
1. Turn on power to your computer and display.
2. After system boot-up, the DOS prompt should bc C >
3. Be sure the DOS file DISKCOPY.EXE is in the C:\ directory. Then, type DISKCOPY A: A:
4. Insert the source diskette (your DAS-40 Distribution Software diskette) into Drive A. The system
will prompt you through the disk copying process. When the source diskette has been copied into
memory, the System will ask you to insert the tar@ diskette into Drive A. The tarpet diskette is
a formatted, blank disk that is to be your back-up disk.
5. When a copy is complete, the computer will ask COPY ANOTHER (Y/N)?. Respond by typing
Y for another diskette or N if you are finished copying. If you typed Y, repeat Steps 3 and 4.
6. Put the original DAS-40 diskcttc(s) in a safe place. Label the back-up diskcttccs) DA.540 Wurkiq
Disk and USC running your DAS-40 programs.
for
Dual-Floppy-Drive Machines
To copy your Distribution Software to thecomputer's hard disk, refer to the next subsection, Ilard-
Drive Machines To copy to another diskcttc(s) in a dual-floppy-drive machine,
2-1
DAS-40 USER GUIDE
1. Turn on power to your computer and display, and place your DOS diskette in Drive A.
2. The DOS prompt should be A > If not, type A: followed by < Enter > Bc sure the diskcttc in
Drive A contains the DISKCOPY.EXE file.
3. Thcn,type DISKCOPY A: B:
4. Insert the sauce diskette (your DA'S40 diskette) into Drive A. The system will prompt you
through the disk copying process. It will ask you to insert the target diskcttc into Drive B. The
target diskette is a blank disk that is to be your back-up disk.
5. When a copy is complete, the computer will ask COPY ANOTHER (Y/N)?. Respond by typing
Y for another diskette or N if you are finished copying. If you typed Y, rcpcat Steps 3 and 4.
6. When copying is complete, put the original DA!+40 diskette(s) in a safe place. Label the back-up
diskette(s) DAS-40 Working Disk. Use this disk to run the software.
Hard-Drive Machines
To copy your DAS-40 files to a hard disk:
1. Start your computer. You should see a prompt, which indicates you arc at the DOS lcvcl (for
example, if your hard drive is dcsignatcd as C, you should see the prompt C > ).
2. The following instructions create a special directory for the DAS-40 Distribution Software files.
At the DOS prompt, type: mkdir D40 followed by < Enter > . Change to the DAS-40 directory
by typing: CD D40 followed by < Enter >
3. Place the Distribution diskette into Floppy Drive A and type A: When the prompt chnngcs from
C> to A>,type copy *.* c: followed by < Enter >.
4. When a copy is complctc, the computer will ask COPY ANOTHER (Y/N)?. Respond by typing
Y for another diskette or N if you are finished copying. If you typed Y , rcpcat Steps 3 and 4.
5. You have now copied the contents of the Distribution Software diskcttc to your hard disk. Store
the original diskcttc in a safe place.
2.3 UNPACKING AND INSPECTING
After you remove the wrapped board from its outer shipping carton, proceed as follows:
1. Place one hand firmly on a metal portion of the computer chassis (the computer must bc turned
Off and grounded). You place your hand on the chassis to drain off static electricity from thr
package and your body, thereby preventing damage to board components.
2. Allow a moment for static electricity discharge; carefully unwrap the board from its anti-static
wrapping material.
3. Inspect the board for signs of damage. If any damage is apparent, return the board to the factory.
4. Check the contents of your package against its packing list to bc sure the order is complctc.
Report any missing items to the manufactorcr immediately.
You may find it advisable to retain the packing material in cast the board must bc rcturncd to the
factory.
2-2
CHAPTER 2: SETUP & INSTALLATION
2.4 CONFIGURATION OPTIONS
The subsections that follow describe DAS-40 configuration options you may set prior to board
installation. These options are either switch- or jumper-selcctablc and include the following:
l Setting the Base Address.
l Setting the DMA Channel(s).
l Setting the Interrupt Level.
l Setting A/D functions:
- Input Range
- Coding
- Input Configuration
l Setting D/A functions:
DAC 0 Output Range
- DAC 1 Output Range
Figure 2-l shows switch and jumper locations for thcsc settings
Figure 2-1. Switch and jumper locations. Note that R21 Is not present on the
Board's G2 verslon.
lncludcd in the Distribution Software is the utility CONFIG40.EXE. This utility is provided as an aid
to changing the jumpers and Dip Switches on the DA%40 board. Refer to the section in Chapter 3
called CHANGING THE FACTORY CONFIGURATION for more detail.
Base Address
Check Base Address setting on the board's Base
Address switch, which is a 6-position DIP switch
labelled SW6 BASE ADDRESS This switch is preset
at the factory for an address of 240 Hex.
Figure 2-2. Dlagram of the Base Address
switch (SW6).
2-3
DAS-40 USER GUIDE
The factory-preset Base Address of 240 Hex is within the address range shown in the following table
as Reserved This default value will function in most computers without conflict, thereby eliminating
any need for address selection and configuration. However, if you have a need to change the Base
Address from its preset value, you must sclcct an address within a range of 200 to 3E0 Hex (512 to 992
Decimal). In addition, the address must be on a 16-byte boundary and must not conflict with
addresses already in use for other devices. As an aid to selecting a usable 3-d@ Hex number, the
following table is an industry-standard I/O address map for the full 000 to 3FF range.
Table of Industty-standard l/O addresses for perlpheral devices.
HRX RANGE USAGE HEX RANGE USAGE
000 to I FF Internal System 387 to 37F LPTI:
200 to ZOF Game 380 IO 38C SDLC comm.
210 to 217 Expansion unit 380 to 389 Binary comm. 2
220 to 24F RCSMVCd 3A0 to 3AY Binary comm. I
278 LO 27F RCSCrVed 3B0 to 3BF Mono dsp/LPT I :
2FOto 2F7 LPl-2: 3C0 103CF RCSWVCd
2F8 to 2FF COM2: 3D0 LO 3DF Color bmphics
300 LO 31F Pro1otypccard 3E0 to 3E7 RCSClVCd
320 to 32F Hard disk 3F0 to 3F7 Floppy disk
3F8 to 3FF COMI:
DMA Channel
The DAS-40 allows you to sclcct DMA transfer channels. While you may select two channels for
DMA (if two arc available), the second channel is used only when Dual-DMA mode or continuous
cycle is selected. Using SW5 (refer to Figure 2-l), you may sclcct DMA Channel 5 (highest priority),
Channel 6, or Channel 7 (lowest priority). The Board is factory-preset to select Channel 5 as the first
channel and Channel 6 as the second. SW5 is a 4-position DIP switch whose setting options are as
follows:
FIRST DMA SECOND DMA
CHANNEL CHANNEL
CHANNEL # Sl s2 s3 s4
5 Off On* err On
6 Oil Off On Oft-+
7 Oil On On On
None Off Off Off Off
* Factory Configuration.
Note that a DMA channel used by one board may not be used by any other board (including another
DAWO) in the same PC system. In a multiple DAS-40 system, you must set each board to a different
channel, limiting Dual-DMA and/or continuous cycle usage to a single board and rtting remaining
boards to USC single-channel DMA.
Interrupt Level
The DAS-40 can interrupt the processor on any one of five different Icvcls. Priority for these five
2-4
CHAPTER 2: SETUP & INSTALLATION
Interrupt Levels is Level 10 (highest), Level 15, Level 3, Level 5, and Level 7 (lowest).
The board is factory preset for Interrupt Level 15. You may change the Interrupt Lcvcl setting by
repositioning the J2 jumper (refer to Figure 2-l) according to the following table.
INTERRUPT JUMPER
LEVEL POSITION
IO 1
*15 2
3 3
5 4
7 5
None 6
* Factory Configuration.
A DAS40 gcncratcs only one interrupt, regardless of cause. The Interrupt Service Routine must
determine the cause of the interrupt by polling the ADCSR, DACSR, and SUPCSR (see Section 5.1).
Upon finding the cause of the interrupt, the Interrupt Service Routine can act accordingly.
Note that an Interrupt used by one board in a PC must not be used by any other board in the PC. In a
PC using Multiple DAS-40 boards, each board must be set to a different Interrupt Level. A board that
needs no Interrupt should be set to disable its Interrupts.
AID Functions
The Analog-to-Digital section of the DAS-40 is switch-selectable for the following:
l Input Range.
l Binary, Offset Binary, or 2's Complement coding.
l Single-ended or Differential input.
The following subsections dexribc settings for these parameters.
Input Range
If a board is configured for Unipolar inputs, it should receive only positive voltages. If configured for
Bipolar inputs, it can accept both positive and negative voltages. The DAS-40 is factory preset for
Bipolar inputs of ilOV. To change this range, reset positions Sl and S2 of DIP Switch SW3 according
to the following table.
SW3
POSITIONS
RANGE Sl SO?
Bipolar +lOV * Off Off
Bipolar C5V 0" Off
Unipolar +lOV 0" 0"
* Factory Configuration.
2-5
DAS-40 USER GUIDE
NOTE: A change of input range may require a recalibration of the A/D converter to attain full-
rated accuracy. Set Chapter 6 for the calibration information.
Bipolar inputs may be either Offset Binary or 2's Complement Output Coding. Unipolar inputs
should be straight Binary Output Coding.
Output Coding
A/D conversion changes an analog input signal to a corresponding digital format so that it can bc
processed by the PC. The output from a DAS40 is a binary data word whose coding is selected with
Switch SW3-3.
As mentioned in the prcccding subsection, Bipolar inputs use either Off& Binary or 2's Complement
Output Coding, while Unipolar inputs USC straight Binary Output Coding. The DAS40 is preset for
Offset Binary coding but offers switch selectable Straight Binary and 2's Complement codings, as well.
You may select output coding by setting Position 53 of DIP Switch SW3 according to the following
table.
SW3
POSITION
CODING s3
Straight Binary (Unipolar) On
Offset Binary (Sip&u)* On
2's Complement (Bipolar) Off
* Factory Configuration
Single-Ended/Differential Inputs
The DAS-40 is switch-sclcctable for either Single-Ended or Differential Input modes. In Single-Ended
mode, the board offers 16 channels for 16 different signals, each with a common return path. In
Differential mode, the board uses a separate return path for each input signal and is thus limited to
eight different signals. To configure the board for either input, set Switch SW4 according to the
following table.
CONFIGURATION POSITION
16 Single-Ended* Left
8 Diffcrcntial Right
* Fac~olyConfiguration
D/A Functions
A DAS-40 board contains two Digital-to-Analog Converters (DACs) which are individually selcctablc
for Unipolar or Bipolar output ranges. In a Unipolar configuration, a DAC carries positivevoltage
outputs only. In a Bipolar configuration, a DAC carries either positive or ncgativc voltage, so long as
the Icvel is within the sclcctcd range (+lOV, f5V, i2.5V, 0 to lOV, or 0 to 5V).
Set the DAC 0 output range selection using positions Sl through 55 of DIP Switch SW2, as follows:
2-6
CHAPTER 2: SETUP & INSTALLATION
SW2 POSITIONS
DAC 0 OUTPUT RANGE Sl s2 s3 s4 s5
*1ov* Off On Off Off on
+5V Off On 0" ofr on
zk2.5V 0" Off 0" Off 0"
0 to 1ov Off on On On Off
otosv 0" Off 0" On OTf
* Faclory Configuration.
Set the DAC 1 output range selection using positions Sl through S5 of DIP Switch SWl, as follows:
SW1 POSITIONS
DAC 1 OUTPUT RANGR Sl s2 s3 s4 S5
+1ov* Off On Off 011 011
i5v Off On On Off On
i2.w Oil Off On Off 011
0 LOIOV Off On 0" 011 Off
oto5v 0" Off On On 00
* Factory Configuration
In Unipolar operation, the DAS40 uses digital data in Straight Binary coding. In Bipolar mode, the
board uses data in Binary Offset coding.
NOTE: After selecting a new output range, you must rccalibratc the DAC (see calibration
procedures).
2.5 HARDWARE INSTALLATION
Single-Ended vs. Differential Connections
SingleEnded configuration of the DAS-40 allows 16 channels to bc made available for analog signals,
while Differential configurations allows eight channels. Thus, SingleEnded configuration offers
maximum channel density. Howcvcr, Sin&-Ended configuration is more sensitive to "ok from the
i"put cables and is therefore bcttcr suited to applications using higher-level input voltages (over IV
Full-Scale) and shorter cable lengths (under 15').
When configuring for Single-Ended operation, connect the return sides of all analog channels to Amp
Low, and connect the high side of each analog input to the corresponding input of the multiplcxcr in
the A/D Converter.
When configuring for Differential operation, connect the high and low sides of an analog input signal
to the corresponding inputs of the multiplcxcr stage. Sa Section 1.4 for more detail.
2-7
DAS-40 USER GUIDE
Installing the DAS-40 in a PC
WARNING: ANY ATTEMPT TO INSERT OR REMOVE A BOARD WITH THE COMPUTER
POWER ON COULD DAMAGE YOUR COMPUTER!
1. Turn Off power to the PC and all attached equipment.
2. Remove the cover of the PC as follows: First remove the cover-mounting screws from the rear
panel of the computer. Then, slide the cover of the computer about 3/4 of the way forward.
Finally, tilt the cover upwards and removc.
3. Choose an available option slot. Loosen and remove the screw at the top of the blank adapter
plate. Then slide the plate up and out to remove.
4. Hold the DAS-40 board in one hand placing your other hand on any metallic part of the PC/AT
chassis (but not on any components). This will safely discharge any static electricity from your
body.
5. Make sure the board switches have becn properly set (refer to the prcccding section).
6. Align the board connector with the desired accessory slot and with the corresponding rear-panel
slot. Gently press the board downward into the socket. Sccurc the board in place by inserting the
mar-panel adapter-plate screw.
7. Replace the computer's cover. Tilt the cover up and slide it onto the system's base, making sure
the front of the cover is under the rail along the front of the franc. Rcplacc the mounting screws.
8. Plug in all cords and cables. Turn the power to the computer back on.
You are now ready to make any necessary system connections, install the DAS-40 software, and
perform calibration and perform checks on calibration and adjustment, as described in the chapter on
calibration.
The manufacturer recommends that you retain the static-shield packaging for possible future removal
and handling of the DA%0 board.
2-8
CHAPTER 2: SETUP & INSTALLATION
2.6 DAS-40 & STA-40 I/O CONNECTIONS
m-40
DAS-40 STA-40 I,"",0
Connector
SIGNAL NAME PIN NO. PIN NO.
Channel 0 1
Channel 8 (0 Ret) 26
Channel 1 2
Channel 9 (1 Ret) 27
Channel 2 3 5
Channel 10 (2 Ret) 28 6
Channel 3 4 7
Channel 11 (3 Ret) 29 8
Channel 4 5 9
Chard 12 (4 Ret) 30 10
Channel 5 6 II
Channel 13 (5 Ret) 31 I2
Channel 6 7 I3
Channel 14 (6 Ret) 32 I4
Channel 7 8 15
Channel I5 (7 Ret) 33 16
AGND Y 17
Amp Low 34 18
+l5V out IO 19
-15v Out 35 20
PGND II 21
DAC 0 Out 36 22
DAC 0 GND 12 23
DAC 1 Out 37 24
DAC 1 GND 13 25
DGND 38 26
DGND 14 27
DIO Port 0. Bit 0 39 28
DIO Port 0. Bit 1 15 29
DIO Port 0, Bit 2 40 30
DIO Port 0. Bit 3 16 31
DGND 41 32
DIO Port 0, Bit 4 17 33
DIO Port 0, Bit 6 42 35
DIO Port 0, Bit 5 18 34
DIO Port 0, Bit 7 43 36
DGND 19 37
DIO Port I, Bit 0 44 38
DIO Port I, Bit 1 20 39
DlOPort l,Bit2 45 40
DlO Port 1, Bit 3 21 41
DGND 46 42
DIO Port I, Bit 4 22 43
DIOPort 1. Bit 5 47 44
DIO Port 1, Bit 6 23 45
DIO Port 1, Bit 7 48 46
DGND 24 47
DGND 49 48
Ext. Trigger IN 25 49
Ext. Clock IN 50 50
2-9
DAS-40 USER GUIDE
2-10
CHAPTER 3
PROGRAMMING NOTES
3.1 GENERAL
At the lowest lcvcl, DA'540 is programmable with I/O (Input/Output) instructions. In BASIC, thcsc
are the IMP (X) and OUT X,Y functions. Assembly Language and most other high- lcvcl languages
have equivalent instructions (IN AL,DX and OUT DX,AL). USCof these functions usually involves
formatting data and dealing with absolute I/Oaddrcsses. Although not demanding, this can require
many lines of code and necessitates an understanding of the devices, data format, and architccturc of
the DAS40. To simplify DAS40 programming, the Distribution Software contains a software driver
(MDAS40,EXE) and Language Intcrfacc Modules for BASIC and QuickBasic (DAS4O.BIN. DAS40,LIB
and DAS40.QLB).
The MDAS40.EXE software driver installs readily from the DOS command line and is accessible from
BASIC and QuickBASIC with a single-line CALL statement. The driver supports the majority of
common operating MODES. Using the CALL routine for DAS40 MODES, you may program your
applications to sclcct and perform any DAS-40 function, format and error-check data, and pcrfomm
frequently used sequences of instructions. An example is MODE 3 which sets up the A/D Start/Stop
channels and the Global Gain value.
The DAS-40 software driver saves programming time and supports data collection using DMA from
an external clock source or the DAS40 internal timer. Note that BASIC has no DMA prowssing
functions; "background" data collection is available only by using the CALL routine.
Both methods of programming using INP and OUT functions and the CALL routine achieve thr same'
result; you are free to choor either, although usually the BASIC programmer will find the CALL
routine simpler to implement. If the DAS-40 MODES described in this manual do not support your
rcquiremcnts, you may modify the DAS-40 driver as necessary. The fully commented assembly
source is available from the manufacturer on a floppy disk (Part # l'CF-40) and is a good starting point
for Assembly Language programmers wishing to modify the standard driver routines.
3.2 THE LANGUAGE INTERFACE MODULES
DA%0 Distribution Software includes the Language Intcrfacc Modules for BASIC and QuickBasic
These are:
DAS4O.BIN lntcrfacc Module for BASIC(A) that is loaded via the BLOAD Command.
DAS40.LIB Interface Module for QuickBASIC (VW 4.0 and higher) and Professional
Basic (VW 7.0 and higher) Stand-alone EXE programs.
DAS40.QLB Intcrfacc Module for the QuickBasic Wcr 4.0 and higher) Programming
Environment. It is spccificd at the QB invocation time using the /L
switch as follows:
QB IL DAS40.QLB
DAS40x.QLB lntcrfacc Module for the QuickBasic Extended Wer 7.0 and higher)
Environment. It is specified at the QBX invocation time using the /L
switch as follows:
QBX /L DAS40x.QLB
3-1
DAS-40 USER GUIDE
All CALL mode communications with the DAS-40 driver is performed through thcsc Interface
Modules. Other interface modules are available from the manufacturer for Pascal, C and FORTRAN
by ordering the PCF-40 option.
A typical CALL statement from your BASIC program to the driver is as follows:
380 ND% = 0 'Initialize mode
390 FLAG% = 0 'Clear error variable
400 D%(O) = 0 'Specify Card #O
410 CALL DAS4O(MD%, D%(O), FLAG%) 'Call the driver
420 IF FLAG% <> 0 THEN PRINT "MODE 0 Error # "; FLAG% AND 255: STOP:
The CALL from QuickBASIC differs only in the CALL statcmcnt (Line 410), as follows:
410 CALL BASDAS4O(MD%, VAWTR(D%(O)), FLAG%)
The three variables within the parentheses (MD%, D%O and FLAG%) arc the CALL paramctcrs. In
executing the CALL, the addresses of the variables (pointers) are passed in the sequcncc written to
BASIC's stack. The CALL routine unloads these pointers from the stack and uses them to locate the
variables in BASIC's data space so data can be exchanged with them.
Note that, FLAG% is a Ibbit quantity containing the error number in the least-significant eight bits
and the mode number where the error occurred in the most-significant eight bits. Therefore to extract
the error number, FLAG% must be ANDcd with 255 (OFFH).
Also note, that D%O must be previously dimcnsioncd as a ten-item integer array. For example,
160 DIM D%(lO)
The following formatting requirements that must be met:
1. The CALL parameters are position-sensitive. The subroutine (DAS40 or BASDAWI) knows
nothing of the names of the variables, just their locations from the order of their pointers on the
stack.
2. The CALL routine expects its parameters to be integer-type variables; it writes and reads to thr
variables on this assumption. If you slip up and use a non-integer (real, single, or doublc-
precision) variable in the CALL parameters, the routine will not function correctly. No error
checking is done in the CALL on the variable type; so take cart not to crash the computer!
3. You cannot perform any arithmetic functions within the parameter-list parcnthcscs of the CALL
statement. For example,
410 CALL DAS40 (MD% t 2, D%(O) * 8, FLAG%) IILLEGAL!
is ill@ and will produce a syntax error.
4. You cannot USCconstants for any of the parameters in the CALL statement. The following is
illegal:
410 CALL DAS40 (7, 2, FLAG%) 'ILLEGAL!
This must be programmed as shown above.
3-2
CHAPTER 3: PROGRAMMING NOTES
Apart from these restrictions, you can name the integer variables whatever you wish; the names in the
examples are just convenient mnemonics. Strictly, you should declare the variables before executing
the CALL. If you do not, the simple variables will be declared by default on execution, but array
variables cannot be dimensioned by default and must be dimensioned before the CALL to pass data
correctly if used as a CALL parameter. Most MODES of the DAS40.BIN CALL routine rcquirc
multiple items of data to be passed in an array. For this reason, D%(O) is specified as the data variable
so that the CALL routine can locate the whole array from the position of its initial clement.
Interface For BASIC(A) - DAS40.BIN
If you are new at using CALL statements in BASIC(A), the following may assist you in understanding
how the CALL transfers execution to the Software Driver through the Interface Module (DAS40.BIN).
Prior to entering the CALL, use DEF SEG = SG statement to set the segment address of the CALL
subroutine as follows:
100 CLEAR, 49152! 'reduce workspace to 48K
110 DEF SEG = 0
120 SG = 256 * PEEK(&HSll) + PEEK(&HSlO) 'find BASIC's segment
130 SG = SG + 49152!/16 'Find segment above BASIC
140 DEF SEG = SG 'SG = load location
150 BLOAD "DAS40.BIN", 0 'for the .BIN:
Note that the details of the DEF SEG statement are complicated and extend beyond the scope of this
manual; therefore, they are not discussed here. For a working example of this routine, refer 1o the
BASIC program BAEXAMI'L.BAS in the Distribution Software.
After the successful BLOADing of DAS40.BIN, the typical CALL statement from your BASIC program
iS
380 MD% = 0 'Initialize mode
390 FLAG% = 0 'Clear error variable
400 D%(O) = 0 'Specify Card it0
410 CALL DAS'IO(MD%, D%(O), FLAG%) 'Call the driver
420 IF FLAG% <> 0 THEN PRINT "MODE 0 Error # "; FLAG% AND 255: STOP:
The word DAS40 in line 410 is the label assigned to be used from BASIC(A) only. Refer to the
previous section for discussion on the CALL syntax.
Interface For QuickBASIC - DAS4O.LIB, DAS40.QLB
Interfacing your QuickBASIC programs to the DAWO is a lot simpler than interfacing from BASIC(A);
it is done simply by linking your program's object module(s) to either DAS4O.LIB or DAS4O.QLB
(DAS40x.QLB if using QuickBASIC Extended Ver 7.0).
You use the .QLB module when running your programs from within the QuickBasic Integrated
Environment. Specify the module with the IL switch when you first invoke QuickBASIC, as follows:
QB IL DAS40,QLB your-file-name
3-3
DAS-40 USER GUIDE
USCthe .LIB module when you want to crcatc stand-alone .EXE programs. To do this, you must
compile and link your program as follows:
BC example.bas lo ;
LINK example,,,DAS40.LIB;
whcrc example is the name of your program, BC is the QuickBASIC Compiler and LINK is the
Microsoft linker.
Regardless of the module you USC(.LIB or .QLB), the actual CALL statement is as follows:
180 ND% = 0 'initialize mode
190 FLAG% = 0 'declare error variable
200 D%(O) = 0 'Card #0
210 CALL SASDASllOfMDB, VARPTRIDBIO~~, FLAG%)
220 IF FLAG% <> O.TXEiJ PRINT 'i.fOtiE'b'Error k "; FLAG% AND 255: STOP
where BASDAS40 is the label assigned for use from QuickBASIC only. Refer to Section 3.2 for
discussion on the CALL syntax and restrictions. For a working example in QuickBASIC, r&r to the
program QBEXAMPL in the Distribution Software.
3.3 LOADING/UNLOADING THE DAS-40 SOFTWARE DRIVER
The DAS-40 Device Driver consists of the two files MDA%O.EXE, and VIPARSE.EXE. As executable
files, both arc self-loading. Loading and unloading may be performed from the DOS command line.
At the DOS command line, type the following:
VIPARSE
followed by
MDAS40 lCO= file0 ICI = file/
Where fiJd and file1 are optional configuration files for Cards #Oand Card #l, rcspcctivcly. Thcr
files are presumed created via the Distribution Software utility CONFlG4O.EXE. Rcfcr to the Section
3.4 ( CHANCING THEFACTORYCONFICURATION) formorcdetail. Specification of switches /CO=
and /CZ= is optional. If you specify no switches, Factory Configuration is assumed for up to two
physical boards. If you specify both /CO= and /Cl = , their order on the command line is irrelevant.
These loading commands may be entered automatically on power-up by adding them to your
AUTOEXECBAT file. Use any ASCII text editor or a word processor to add the commands in the
order shown abovc.
The DAS40 Device Driver (both files) may also be unloaded from the DOS Command lint. Unloading
the Device Driver returns the memory it occupies to DOS. The Device Driver files must be unloaded
in the following order: first MDAS40.EXE, then VIPARSE.EXE.
3-4
CHAPTER 3: PROGRAMMING NOTES
To unload MDAS40.EXE, type the following:
MDAS40 /U
and for VIPRASE.EXE,
VIPARSE IU
Note that VIPARSE and MDAS40 occupy approximately 7600 bytes and 18000 bytes rcspwtively.
3.4 CHANGING THE FACTORY CONFIGURATION
Provided with the release software is the utility: CONFIG40.EXE. This utility saws as an aid for
setting the Jumper and Dip Switch settings and as a means for generating a disk file containing new
board configuration information. To execute this utility, proceed as follows:
From the DOS Command Prompt, type the following:
CONFIG file
Whcrc file is a valid DOS file name, which may include any necessary DOS Drive and path
specification.
For example,
CONFIG C:\DAS'IO\CARDO.CFG
If the specified file does not exist, the default Factory Configuration is displayed; otherwise the
contents of the file are shown.
If the file name is omitted, the CONFIG help screen is displayed. Follow the instructions as they
appear on the screen.
The Configuration file created here is used when loading the DAS-40 Driver. Refer to Section 3.3
( LOADING/UNLOADING THE DAS-40 SOFTWAREDRIVER ) for more detail.
Note that the files created by the CONFIG utility arc in binary format and thcrefor not rcadablc or
suitable for editing using standard text editors. All changes to thcsc files must occur using this utility.
3.5 THE CALL MODES
The following table identifies DAS-10 MODES (see Chapter4 for descriptions). The MODES arc
sclcctcd by the MD% parameter in the CALL as follows:
3-5
DAS-40 USER GUIDE
MD% FUNCTION
0 Initialize and Query Configuration of an installed DAS-40.
1 Assign a buffer and sample count to each DMA level for both A/D and D/A. Used
bcforc calling MODES 4 or 5.
2 Setup for N A/D or D/A conversions for transfer via DMA. Used before calling MODES
4 or 5.
3 Setup global start and stop channels and ovcralt gain.
4 Start A/D conversions and transfer via DMA as setup in MODES 1 + 2.
5 Start D/A conversions and transfer via DMA as rhrp in MODES I + 2.
6 Setup Pacing clock rate.
7 Perform one A/D conversion on specified channel.
8 Perform one D/A conversion on DAC channel (1,2, or both).
9 Monitor ADC/DAC DMA transfer status.
10 Setup for Digital Input/Output.
11 Input Byte/Word.
12 Set/Query current DA%0 Card number
13 Terminate Current DMA transfer-A/D In or D/A Out.
14 Output Byte/Word.
15 Tag channel numbers to data.
16 A/D Triggered Block Scan (DMA).
17 Transfer A/D Data to a BASIC Array.
18 Allocate DMA Memory Block
19 Free DMA Memory Block
3.6 DEFAULT CONFIGURATION
The DAS-40 Software Driver assumes the following Factory Default conditions for DAS-40 Card
Number 0:
BASE ADDRESS: 240H
DMA CHANNEL A: 5
DMA CHANNEL B: 6
INTERRUPT LEVEL: 15
A/D MODE: 16.CHANNEL SINGLE-ENDED
A/D INPUT RANGE: i1ov
A/D CODING: OFFSET BrNARY
DAC #ORANGE: +1ov
DAC #l RANGE: +1ov
Card Number 0 is assumed to be of the G2 variety (l/2/4/8 Gain).
If this configuration is not compatible with your system rcquircmcnts, refer to Section 3.4
( CHANGING THE FACTORY CONFIGURATION ) for instructions on making changes.
3-6
CHAPTER 3: PROGRAMMING NOTES
3.7 ACCOMMODATING MULTIPLE DAS-40s IN A SINGLE SYSTEM
The supplied software driver MDAS4O.EXE supports up to two (2) DAS-40 boards simultaneously.
The default configuration of a possible second board are identical to the Factory Configuration of the
first board except for the following:
BASE ADDRESS: 250H
DMA CHANNEL A: 7
DMA CHANNEL 8: NONE
INTERRUPT LEVEL: 10
To override the factory settings, use the /Cl= switch as dcscribcd in Section 3.3
( LOADING/UNLOADING THE DAS-40 SOFTWAREDRIVER ).
Because the DAS-40 is designed to use DMA channels 5,6, and 7, Dual-DMA modes arc not allowed
for the DAS-40 board configured with only one channel.
888
3-7
DAS-40 USER GUIDE
cl
3-8
CHAPTER 4
CALL MODES
In each of the following CALL MODE discussions, the usage explanations include two subheadings,
as follows:
In a program that CALLS a particular MODE with the statement CALL DAS40 (MD%, D%(O),
FLAG%), the parameters are the acceptable values for the MD% array D%O. For
example, the following Initialization Parameters are for MODE 3.
MD% = 3 (the MODE number).
D%(O) = Start channel # (0 - 15 for S.E.;0 - 7 for Diff.).
D%(l) = Stop channel # (0 15 for S.E.; 0 - 7 for Diff.).
D%(2) = Overall gain code (0 - 3, according to the following table)
CODE c.1 G2
0 1 I
1 IO 2
2 100 4
3 SO0 8
In a typical program (in BASIC) CALLing MODE 3, you might use thcsc arguments to initialize MD%
and D%(O) as follows:
MD% = 3 ' Specify the MODE number.
D%(O) = 0 ' Specify a starting channel number.
D%(l) = 12 ' Specify an ending channel number.
D%(2) = 2 ' Specify a Gain Code (from the table).
CALL DAS40 (MD%, D%(O), FLAG%) ' Execute the CALL.
The parameters may be m-initialized for different values and the CALL repeated as many times as
desired. Refer to the Distribution Software for fully functional example programs that USCthese
MODES.
After the CALL, any values or information that might bc returned as a result of the CALL arc listed
under Returns.
Note that the FLAG% parameter (for Errors) does not require initialization. Error Codes that might
be rctumcd for FLAG% arc discussed in Appendix C.
4-1
DAS-40 USER GUIDE
4.1 MODE 0 - QUERY CONFIGURATION AND INITIALIZE AN
INSTALLED DAS-40
This mode initializes the board's hardware registers and subsystems to a known state. The board is
initialized according to the information found in the internal data tables of the DAS-40 Driver. The
information maybe modified whenever the Driver is loaded from the DOS Command Line. If
nothing is specified at load time, the Factory Configuration of the DAS-40 board(s) is assumed; refer to
the section on switch and jumper settings in this manual for more detail.
To modify the Factory Configuration of the DAS-40, you must (with the DAS-40 out of the PC) run the
utility CONFIG40.EXE (in the Distribution Software). This utility provides a means for creating a
Board Configuration File and an aid for setting the on-board jumpers and dip switches. The Board
Configuration File is used when loading the DAS-40 Driver to override the Factory Configuration.
Refer to the section on changing the DAS-40 configuration for more detail.
The Pacer Clock defaults to 40KHz, and the Digital I/O Ports assume DIO Configuration Code 0 fol
word input.
MODE 0 Parameters:
D%(O) = Card # to initialize (0 or 1)
MODE 0 Returns:
D%(O) = The Card's Base Address
D%(l) = Interrupt request lcvcl
D%(2) = DMA Channel A
D%(3) = DMA Channel B
D%(4) = A/D Data Coding: 0 = Offset Straight Binary *
1 = Straight Binary
2 = 2's Complement
D%(5) = A/D Mode: 16 = Single Ended
8 = Differential
* For information on A/D coding. rcfcr to Appendix A
4.2 MODE I- SPECIFY DMA BUFFERS AND CONVERSION COUNTS
This mode is used to setup the addrcss(cs) and conversion count(s) for the next DMA A/D or D/A
operation. Through this mode, you can setup addresses for single (Buffer A) or dual (Buffers A and B)
DMA operations. The addresses and conversion counts passed to this mode are generally obtained
through previous calls to Mode 18. Although the addresses of user arrays may be used as DMA
buffers instead, these are not guaranteed to be suitable for DMA; i.e. Mode 1 may return error 13 or 22.
For the BASIC languages, specifying a conversion count greater than 32767 into an integer variable
causes an Overflow error. The following illustrates how to specify 50,000 samples in D%(2) without
causing an Overflow:
D%(2) = 50000 - 65536
4-2
CHAPTER 4: CALL MODES
Buffer B parameters, D%(3), D%(4) and D%(5), are required only when Dual DMA operation is
desired; specify zeroes when not used.
MODE 1 Parameters:
D%(O) = DMA Buffer A Offset
D%(l) = DMA Buffer A Segment
D%(Z) = Samples for Buffer A
D%(3) = DMA Buffer B Offset (required for Dual DMA only)
D%(4) = DMA Buffer B Segment (required for Dual DMA only)
D%(5) = Samples for Buffer B (required for Dual DMA only)
MODE 1 Returns:
No returns.
Intermeted BASIC:
Thcrc arc three ways to use this mode from Interpreted BASIC:
1. Specify the values returned by Mode 18 call, or
2. Specify an absolute address, or
3. Specify the address of a user array.
Method 1. is preferred while methods 2. and 3. are not recommended
Example using Method 1:
100 ' ALLOCATE A MFMORY BUFFER
110 ND% = 18
120 D%(O) = ASAMPLES ' DESIRED SAMPLES
130 CALL DASQO (MD%, D%(), FLAG%)
140 ' SAVE BUFFER PARAMETERS
150 ASAMPLES = D%(O) ' ACTUAL SAMPLES
160 AOFFSET = D%(l) ' BUF A OFFSET
170 ASEGMENT = D%(2) ' BUF A SEGMENT
180 ' PASS BUFFER PAPAMETERS TO MD% 1
160 ND% = 1
170 D%(O) = AOFFSET ' B"F A OFFSET
180 D%(l) = ASEGMENT I BUF A SEGMENT
190 D%(2) = ASAMPLES ' B"F A SAMPLES
200 D%i3j = 0
210 CALL DAS40 (MD%, D%(), FLAG%)
Example using Method 2:
520 ND% = 1
530 FLAG% = 0
540 D%(O) = 0 ' Offset 0
550 D%(l) = &II7000 1 segment
560 D%(2) = 20000
When using an absolute address, you must make sure that memory location is not currently used as
program or data arca.
4-3
DAS-40 USER GUIDE
QuickBASIC:
There are two methods to use this mode from QuickBASIC:
1. Specify the values returned by Mode 18 call, or
2. Specify the address of a user array.
Method 1 is required for stand-alone EXE programs, while method 2 is required when running your
programs from within the QuickBASIC integrated environment. User arrays used as DMA buffers
must be declared as $DYNAMIC. Use VARSEG and VARI'TR to get the segment and offset as shown
below.
QuickBASIC example using Mode 18:
' ALLOCATE A MEMORYBUFFER
ND% =lS
D%(O) = ASAbfPLES ' DESIRXD SAMPLES
CALL DAS40 (MD%, D%() , FLAG%)
' SAVE BUFFER PARAMETERS
ASAMPLES = D%(O) ' ACTUAL SAMPLES
AOFFSET = D%ilj ' BUF A OFFSET
ASEGMENT = D%(2) 1 B"F A SEGMENT
' PASS BUFFER PARAW?,
TERS TO MD% 1
MD% =1
D%(0) = AOFFSET ' BUF A OFFSET
D%(1) = ASEGMENT ' BUF A SEGMENT
D%(2) = ASAMPLES ' BUF A SAMPLES
D%(3) = 0
CALL DAS40 (MD%, D%(), FLAG%)
QuickBASIC example using a user array:
' DIMENSION A DYNAMIC ARRAY
REM $DYNAMIC
DIM BUFA(10000) AS INTEGER
REM SSTATIC
' PASS BUFFER PARAMETERSTO No% 1
MD% =l
D%(O) = VARPTR(B"FFA(0)) ' B"F A OFFSET
D%(l) = VARSEG(B"FFA(0)) ' BUF A SEGMENT
D%(2) = 10000 ' B"F A SAMPLES
D%(3) = 0
CALL DAS40 (MD%, D%(), FLAG%)
4.3 MODE 2 - SETUP AN A/D OR D/A DMA OPERATION
Mode 2 specifies the Conversion Clock source, Start Trigger source, Single/Dual DMA mode,
Single/Continuous cycle mode and optionally user Channel and Gain arrays. The Channel and Gain
arrays are relevant when setting up an A/D operation. The Channel array is used when the desired
channel scan consists of nonsequential channels or when sampling the same channel more than once
in the same scan. The Gain array is relevant only when Channel array is spccificd. It is used when it is
dcsircd to sample the channels in the Channel array at diffcrcnt gains.
Alternatively, use Mode 3 for sequential channel scans at a fixed gain, and specify zeros in D%(O) thru
D%(4). If specifying Channel and Gain array, D%(4) holds the number of entries in each array.
If using this mode for D/A operations, D%(O) thru D%(3) are not used and must bc set to zero, and
D%(4) specifies the DAC number as 0,l or 2 (both). The Conversion Clock source, Start Trigger
4-4
CHAPTER 4: CALL MODES
source, Single/Dual DMA mode, Single/Continuous cycle mode are common to both A/D and D/A
operations. When specifying Internal Conversion Clock source, use Mode 6 to setup the desired rate.
MODE 2 Parameters:
D%(O) = Address Offset of a user Channel away
D%(l) = Address Segment of a user Channel array
D%(2) = Address Offset of a user Gain array
D%(3) = Address Segment of a user Gain array
D%(4) = Number of entries in channel/gain arrays: 1 - 16, OR
DAC channel number: 0,l or 2 (both channels)
D%(5) = Start Trigger source: 0 if internal, or 1 if external
D%(6) = Conversions Clock source: 0 if internal, or 1 if external
D%(7) = DMA mode: 0 if single DMA, or 1 if Dual DMA
D%(S) = DMA transfer mode: 0 if single cycle, or 1 if continuous
MODE 2 returns:
No returns
Intcrureted BASIC:
The following code fragment illustrates how to specify channel and gain arrays from lnterprctrd
BASIC.
640 ND% = 2
650 FLAG% = 0
660 D%(O) = VARPTR(CHAN%(O)) ' OFFSET TO CHANNEL-Y
670 D%(l) = -1 FLAG TO USE DEFAULT DATA SEGMENT
680 D%(2) = VARPTR(GAIN%(O)) ' OFFSET TO GAIN ARRAY
690 D%(3) = -1 FLAG TO USE DEFAULT DATA SEGMENT
700 D%(4) = 8 NUMBER OF ENTRIES IN GAIN/GHAN AR&
710 D%(5) = 0 0 => Internal Trigger
720 D%i6j = 0 0 ==> Internal Clock
730 D%(7) = 0 0 ==> Single Buffer DMA
740 D%i8j = 0 0 ==> Single cycle
750 CALL DAS40(MD%, D%(O), FLAG%)
Where CHAN% and GAIN% arc previously dimensioned as lbintegcr arrays and initialized to the
desired values. Refer to the supplied example BAEXAMPL.BAS for illustration.
Note when a Mode calls for segment and offset values, use VARPTR to obtain the offset and USC for -1
the segment value. Specifying -1 informs the driver that this call is from Interprctcd BASIC and that
the Default Data Segment CDS)be used.
OuickBASIC:
The following code fragment illustrates how to specify channel and gain arrays from QuickBASIC.
MD% = 2
FLAG% = 0
D%(O) = VARPTR(CRAN%(O)) ' OFFSET OF CHANNEL ARRAY
D%(l) = VARSEG(CHAN%(O)) t SEGMENTOFCHANNB LARRAY
D%(2) = VAWTR(GAIN%(O)) ' OFFSET OF GAIN ARRAY
D%(3) = V?+RSEG(GAIN%(O)) ' SEGMENT OF GAIN ARRAY
D%(4) = 8 1 NUMBER