Text preview for : 24893A(PCF-20).PDF part of Keithley 24893A(PCF-20) Keithley Misc 24893A(PCF-20).PDF
Back to : 24893A(PCF-20).PDF | Home
PCF-20
Keithley MetraByte Corporation
*****
The
PCF-20
Guide to Using
PASCAL, C, & FORTRAN
Callable Driver Software
for the
DAS-20
Revision A, - 1987
Copyright @ Kelthley MetraByte Corp. 1987
Part Number: 24893
KEITHLEYMETRABYTECORPORATION
440 MYLES STANDISH BLVD., Taunton, MA 02780
TEL. f&8/880-3000. FAX 5W880-0179
...
- 111 -
Warranty Information
All products manufactured by Keithley MetraByte are warranted against defective materials
and worksmanship for a period of one year from the date of delivery to the original
purchaser, Any product that is found to be defective within the warranty period will. at the
option of Keithley MetraByte. be repaired or replaced. This warranty does not apply to
products damaged by improper use.
Warning
Keithley MetraByte assumes no liability for damages
consequent 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.
Disclaimer
Information furnished by Keithley MetraByte is believed to be accurate and reliable.
However, the Keithley MetraByte Corporation assumes no responsibility for the use of such
information nor 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 MetraByte Corporation.
Notes
Keithley MetraByte/Asyst/DAC is also referred to here-in as Keithley MefraByte.
BasicTM a trademark of Dartmouth College.
is
IBM@ is a registered trademark of International Business Machines Corporation.
PC, XT, AT, PS/2, and Micro Channel Architecture@ (MCA) are trademarks of
International Business Machines Corporation.
Microsoft@ is a registered trademark of Microsoft Corporation.
Turbo C@ is a registered trademark of Borland International.
- iv -
Table of Contents
Section 1 INTRODUCTION 2
1.1 General Description: ........................................ 2
1.2 Using the PCF-20 ........................................... 2
1.3 DAS-20Modes ............................................ 2
1.3.1 Listing of Available Modes .............................. 2'
1.3.2 Mode Parameter Descriptions ............................. 4
1.3.2.1 Mode 0: Initialize the DAS-20 4
1.3.2.2 MODE 1: Load the A/D control Queue
1.3.2.3 MODE 2: View the current queue 7"
1.3.2.4 MODE 3: Perform a Single A/D Conversion 7
1.3.2.5 MODE 4: Perform N conversions (program control) 9
1.3.2.6 MODE 5: Multiple A/D conversions-- Interrupt driven 11
1.3.2.7 MODE 6: Multiple A/D samples with DMA data transfer. 13
1.3.2.8 MODE 7: Command a Single D/A conversion 16
1.3.2.9 MODE 8: Load Memory Segment for D/A conversion. 16
1.3.2.10 MODE 9: Multiple Interrupt D/A conversions
1.3.2.11 MODE 10: DMA driven D/A conversions :;:
1.3.2.12 MODE 11: Cancel DMA or Interrupt 19
1.3.2.13 MODE 12: Determine Status of interrupt/DMA 20
1.3.2.14 MODE 13: Transfer data from memory to array
1.3.2.15 MODE 14: Read the Digital inputs 2
1.3.2.16 MODE 15: Write to the Digital outputs.
1.3.2.17 MODE 16: Analog trigger ;i
1.3.2.18 MODE 17: Initialize Timer - Reset timer. 25
1.3.2.19 MODE 18: Set Timer Master Mode Register 25
1.3.2.20 MODE 19: Set Counter `N' Mode Register 26
1.3.2.21 MODE 20: Set Multiple Counter Control Registers 28
1.3.2.22 MODE 21: Set Counter `N' Load Register 28
1.3.2.23 MODE 22: Read Counter `N' Hold Register 29
1.3.2.24 MODE 23: Measure Frequency
1.3.2.25 MODE 24: Set A/D pacer clock i;
1.3.2.26 MODE 25: SET D/A pacer clock
1.3.2.27 MODE 26: Stop A/D and D/A pacer clocks ;`:
1.3.2.28 MODE 27: Perform "N" scans of a block of channels 31
1.3.2.29 MODE 28: Using the EXP-20 33
1.3.2.30 MODE 29: Set SSH-4 Flag 36
1.3.3 SUMMARY OF ERROR CODES . .,. . . . . . . . . . . . . . . . . . . . . . 36
Section 2 DAS-20 PASCAL INTERFACE 39
2.1 Example Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Section 3 DAS-20 C LANGUAGE INTERFACE 42
3.1 Example Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Section 4 DAS-20 FORTRAN INTERFACE 45
4.1 Example Program.. . . . . . . . . . . . . . . . . . . . . . , . . . . . . . . . . . . . . . . . . 46
Section 1
INTRODUCTION
1 .I General Description:
The PCF-20 software package has been developed for Pascal, C, and Fortran
programmers wishing to write data acquisition and control software for MetraByte DAS-20,
EXP-20 and SSH-4 boards. The PCF-20 is supplied on three disks (one for each language). In
addition to the assembly level driver, each disk contains a number of example programs, and a
simple graphics package that may prove helpful in writing display routines.
1.2 Using the PCF-20
Each of the three software drivers supplied in the PCF package are virtually identical
to the standard BASIC driver rouitines provided with the DAS-20. The only difference is in the
way data and computer control are passed back and forth between the user program and the
assembly driver. Different functions of the assembly driver are selected by selecting a Mode.
Currently there are 30 modes (numbered 0 to 29), and each performs a specific function. Rather
than write four redundant descriptions of each mode for each language, this manual refers to the
DAS-20 manual, and specifically Chapter four on programming to describe the funcion of each
of the modes. This manual simply describes the syntax and conventions required to excecute one
of the 30 modes from Pascal, C, and Fortran. However, as a quick reference guied the modes,
and a brief description of the applicable excecution parameters are listed in the next section.
1.3 DAS-20 Modes
1.3.1 Listing of Available Modes
The following DAS-20 functions are supported by the DAS20.BIN driver:
MODE DESCRIPTION~OF~FUNCTION
0 Initialize the DAS-20, (Base Address, Interrupt
level, and DMA level).
1 Load the Channel/Gain queuing RAM
2 View the current Channel/Gain Queuing RAM
-2-
3 Perform a single A/D conversion and load the
data into a BASICA variable
4 Perform an "N" conversion scan and store the
data in a BASICA array, Sample rate is set by
pacer clock or external trigger. and maximum
sample rate is about 4000 samples per second.
5 Perform an "N" conversion scan, and store the
data in memory under interrupt control. Maximum
conversion rate = 4000 samples/set.
6 Perform an "N" conversion scan under DMA
control. Conversion rate is set by on board
pacer clock or by external trigger, Maximum
conversion rate = 100,000 Khz
7 Command a single D/A conversion
8 : Load memory with D/A conversion data for Modes 9
and 10.
9 Perform "N" D/A conversions under interrupt
control.
10 Perform "N" D/A conversions, DMA data transfers.
Conversion timing from pacer clock or external
trigger. Up to 260,000 Conversions per second.
11 Cancel DMA or interrupt driven operations.
Return control completely to program software.
12 Return current status of DMA or Interrupt
driven data transfers.
13 Transfer data from memory into BASICA arrays.
This mode is necessary since interrupt and DMA
driven conversions write and read directly from
memory locations without regard to BASICA
variables.
14 Read the 8 digital input Bits
15 Write to the 8 digital output bits.
16 Set Analog trigger mode. This mode can cause
any other mode to wait until a certain specified
input condition is met before proceeding.
17 Initialize the Counter/Timer chip
18 Set the 95 13 counter's master mode register
19 Set counter "N" mode register
-3-
20 Set Multiple counter control register
21 Set Counter "N" load register
22 Read counter "N" hold register
23 Measure Frequency with counter timer
24 Set D/A pacer clock
25 Set A/D pacer clock
26 Stop A/D & D/A pacer clocks
27 Perform "N" scans of a block of analog input
channels
28 Sample Data from EXP-20 board
29 Set Flag for using SSH-4 accesory board
1.3.2 Mode Parameter Descriptions
The following section provides a much more detailed description of the functions and uses
of each of these modes. Arguments marked with `->' are values passed to the driver. Those
marked with `<-' are return values. Any arguments which are not specified, or are marked with
the value `X' are don't care arguments.
1.3.2.1 Mode 0: Initialize the DAS-20
Mode 0 sets the DAS-20's Base Address, DMA channel, and interrupt level. Mode 0 also resets
the A/D and sample control queue, sets the input gain to 1X, Bipolar, selects input channel
0, and resets the timer (see initialize timer function). A mode 0 initialization call must be
performed before any other "calls" are made to the DAS-20 driver. Trying to execute any other
call before executing a Mode 0 call will generate FLAG% =l, Driver not initialized error. An
example of using Mode 0 is shown in example program EXO.BAS which has been included on
the DAS-20 software disk.
On entry the following parameters should be assigned:
MD% -> 0 `Mode 0
DIO%(O) -> BASE ADDRESS `usually &H300
DIO%( 1) -> Interrupt Level `2 through 7
DI0%(2) -> DMA channel `1 or3
FLAG% <- Error checking flag, the value
before the call does not matter
-4-
The following error codes apply to mode O:-
FLAG% = 0 (no error, o.k.)
=- 1 (mode number out of range, 29)
= (base address out of range 412 or >1008)
=:. (interrupt level <2 or >7)
=3 (DMA level not 1 or 3)
= -3 (Board not present, I/O address wrong)
Error #l will occur if you have specified an I/O address that is less than 512 (Hex 200) or
greater than 1008 (Hex 3FO). I/O addresses below Hex 200 are used internally by devices
on the IBM P.C. system board and would always cause an address conflict and I/O addresses
above Hex 3FF are not decoded on the IBM P.C. Error #2 will occur if you have
specified a non-valid interrupt level. The available levels on the P.C. expansion bus
correspond to 2 thru 7. Certain of these levels may be in use by other peripheral devices
(especially level 6 used by floppy disk drive). A,list of the standard IBM interrupt assignments
is:-
Level 2 - Reserved (but not used) by Color Graphics adapter
Level 3 - Serial I/O - used if COM2: installed.
Level 4 - Serial I/O - used if COMl: installed.
Level 5 - Printer - may be used by LPT2: if installed.
Level 6 - Always in use by disk drives
Level 7 - Printer - may be used by LPTl: if installed.
If you do not have a particular device installed, it is safe to assume that that level is available
for use by DAS-20. The lower the level number, the higher the interrupt priority. Note that
the interrupt will not be enabled unless you enter a mode which requires interrupts for
operation. If you are not going to make use of interrupts any level can be chosen e.g. DIO%( 1)
= 2.
Error #3 is obtained if you specify a DMA level other than 1 or 3. There are 4 DMA levels
available on the IBM P.C. (see Appendix E of the DAS-20 Manual), the highest priority is
internally used for dynamic memory refresh and is not accessible to the user. The other
levels 1 thru 3 are available on the expansion bus, but level 2 is always used by the floppy disk
drive(s) and cannot be shared. In hard disk (XT) computers, level 3 may be used by the hard
disk, but depending on the design of the disk controller hardware and fixed disk BIOS, may in
some cases be available. To determine whether your computer's hard disk uses level 3, run
LEV3.EXE from DOS. In any case level 1 is usually available so if level 3 is used by the hard
disk set DI0%(2) = 1. In floppy disk only machines DI0%(2) can be 1 or 3. Also, note that
DMA requests and the 8237 controller are not enabled until you enter modes 6 or 10. If you are
not using modes 6 or 10, it is irrelevant whether you set DI0%(2) = 1 or 3.
Mode 0 performs several other initializing functions. The Queing RAM sequncer is
cleared. The DAS-20 control and timer counter enable registers are cleared, disabling all
interrupt,DMA and external trigger functions. Mode 0 also performs a simple read/write test
as a check on the function and presence of the DAS-20 hardware. If you obtain error -2, it is
either indicative of a hardware fault in the DAS-20 or more commonly a discrepancy between
the base address specified in DIO%(O) and the actual switch setting on the board.
-5-
1.3.2.2 MODE 1: Load the A/D control Queue
Mode 1 allows the channel/gain queue to be loaded one step at a time. All Analog input modes
except for Mode 3will get the channel number and input range information from the AfD queue.
The Queue is a 2048 Byte RAM that is used to control the analog input multiplexor (which
selects the input channel sampled) and the input instrumentation amplifier (which selects
the input range).
The Queue is loaded using the standard DAS-20 Call in the following format:
MD%-> 1
DIO%(O) -> Channel number (0 to 7 differential
or 0 to 15 single ended.
DIO%( 1) -7 Gain/input range
DI0%(2) -7 Command #
FLAG% c- Error codes
DIO%( 1) Instrument Amplifier Gains and Ranges
Input Range Gain Urn/Bipolar DIO%( 1)
0 to +lOV Xl Unipolar
+/- 1ov x.5 Bipolar
0 to +lOV Xl Unipolar
+/- 5v Xl Bipolar
0 to +lV x10 Unipolar
+/- .5v x10 Bipolar
0 to +lOOmV Xl00 Unipolar
+/- 50mV x100 Bipolar
DI0%(2): Command #
Where Command # is 0, 1 or 2. The available
commands are described below:
0 = normal queue entry
1 = last entry, add EOQ flag
2 = first entry, initialize the counters
FLAG%
FLAG% = 0 (no error, o.k.)
=- 1 (mode number out of range, = 11 (Gain/Input range out of range)
= 12 (Command # out of range)
-6-
The first entry (when DI0%(2) is 2) automatically re-initializes the DAS-20 counters, The
second and subsequent (DI0%(2) = 0) entries simply load the queuing RAM, while the final
entry (DI0%(2) = 1) automatically inserts an EOQ (End Of Queue) bit. An example of loading
and reading the sampling Queue has been provided on the DAS-20 software disk.
1.3.2.3 MODE 2: View the current queue
Mode 2 allows the current RAM Queue to be read. When DIO%(2) is 0, the Queue pointer is
automatically incremented after the read so that the next read will be of the next Queue location.
To reset the Queue pointer to 0, issue the same call with DI0%(2) = 1. An exampleof loading
and reading the Queue has been provided in the EXl.BAS program included on the DAS-20
disk.
Arguments:
MD% -7 2
DIO%(O) <- channel number
DIO%(l) c- Gain
DI0%(2) -7 Command #
DI0%(2) <- EOQ condition
Where "Command #" operates as follows:
0 = get next queue command
2 = reset and return to first command in the
queue
On Return, DI0%(2) will be:
,O -- End of Queue bit not set
1 -- End of Queue bit set
FLAG% <- Errors
0 = (No Error)
-1 = (Mode # out of Range)
1 = (Gain out of range)
2 = (Command # out of range)
1.3.2.4 MODE 3: Perform a Single A/D Conversion
Initialize the A/D converter, set the channel and input range desired, wait for completion, and
return data. Note that this is the only mode that does not perform conversions based on the
Queuing RAM.
-7-
Arguments:
MD%-7 3
DIO%(O) <- A/D data (0 - 4095 if unipolar)
(-2048 to 2047 if bipolar)
DIO%(O) -7 Gain/range selection
DIO%( 1) c-7 A/D channel
FLAG% <- Errors
010%(l) ChanneI select data byte
CHANNEL Number
Single Ended Differential DIO%(O)
0 0 0
1 1
; i
4 4
5
6 z
7 7
8
t 9
10 10
::.
13
14
15
DIO%(O) Instrument Amplifier Gains and Ranges
Input Range Gain Uni/Bipolar DIO%( 1)
0 to +lOV Xl Unipolar 0
+/- 1ov x.5 Bipolar 1
0 to +lOV Xl Unipolar 2
+/- 5v Bipolar 3
0 to +lV EO Unipolar 4
+/- .5v x10 Bipolar 5
0 to +lOOmV x100 Unipolar 6
+/- 50mV x100 Bipolar 7
-8-
FLAG% <- Errors (if any)
= No Errors
= -! Hardware error
=- Mode # out of range
,311 Gain/input range out of range
= 32 Chnnel # out of range (note that if a channel
# between 8 and 15 is entered, and the board
is set to 8 channel Diff operation this error
will result
1.3.2.5 MODE 4: Perform N conversions (program control)
Mode 4 performs N A/D conversions and transfers data directly into an array. Since the CPU
is performing the A/D polling and data transfers as a "foreground" operation, exit from the
CALL will not occur until all conversions have been completed. However, hitting any
key on the keyboard while data is being gathered in mode 4 will abandon futher conversions and
produce an immediate return to your program. If you do not want to wait for data to be
collected, both modes 5 or 6 can be used to gather the data as a "background" operation so that
your program is able to process data and collect it at the same time.
The A/D will perform conversions on channels in accordance with the scan Queue conditions
set in mode 1. When the number of conversions "N" is larger than the number of items held in
the Scan Queue, the Queue resets after sampling it's final entry and begins sampling from Queue
address 0 again. If mode 1 has not been entered prior to mode 4, a Flag% error will be returned.
The A/D may be triggered from 2 sources, the programmable interval timer or an external
trigger pulse according to DI0%(2). If the programmable interval timer is used, then EXT
TRIG acts as a start gate to the operation. If an external trigger is used, trigger pulses are
applied to EXT TRIG and positive edges start conversions.
On entry the following parameters should be initialized:-
MD% -> 4 (mode number)
DIO%(O) -7 Number of conversions required (Word count).
Range 1 to N where N-l c= array dimension
DIO%( 1) -7 --array pointer
Conversions may be loaded starting at the
M'th. position in an array or at the start
if M = 0.
DI0%(2) - Trigger source. There are 3 possible:-
-9-
DI0%(2) = 0 : External trigger input.
Conversions take place on
positive transitions on the
EXT TRIG input and continue
until the word count *
reached. !WARNING! - ex?
from the routine cannot take
place until pulses equal
word count have be:
supplied.
DI0%(2) = 1 : Programmable interval timer
with external gating: The
sample rate is set via Mode
24. EXT TRIG should be held
low until you want to start
conversions. Conversions will
begin as soon as EXT TRIG
goes high and continue until
EXT TRIG is brought low
again, or the word count is
reached.
DI0%(2) = 2 : Programmable interval timer
without external gating. The
sampling mode is set via Mode
24. Sampling begins (based
on Mode 24 sampling rate)
immediately upon excecuting
the Mode 4 call.
DI0%(3) : Data from UNIpolar or Bipolar inputs.
DI0%(3) = 0 : Unipolar data
DI0%(3) = 1 : Bipolar data
Since unipolar (o-4095) and Bipolar (-2048
to +2047) data is in different formats it is
necessary to tell the transfer routine which
type of data is being used. For channel
scans which include both unipolar and
Bipolar either format can be selected then
scaled to the correct form. The scaling
conventions are listed below:
Subtract 4096 from Bipolar data transferred
in Unipolar mode when Value 7 2047.
Add 4096 to Unipolar data transferred in
Bipolar Mode when value < 0.
- lo-
The following error codes apply to mode 4:-
FLAG% = 0 (no error, o.k.)
= -2 (driver not initialized)
= -1 (mode number out of range, = 41 (number of conversions 0 or negative)
= 43 (trigger mode not 0 or 1)
1.3.2.6 MODE 5: Multiple A/D conversions-- Interrupt driven
Mode 5 performs N A/D conversions triggered either externally or by the programmable
timer. At the end of each conversion, an interrupt is generated that invokes an interrupt handler
routine installed by this mode. This routine transfers the data from each conversion to a
specified segment of memory and keeps track of the total number of conversions performed.
When the number reaches N, as specified by DIO%(O), interrupts are disabled if in the non-
recycle mode (DI0%(3)=0), or the process is repeated continuously to the same segment of
memory if DI0%(3) specifies the recycle mode. Note that once mode 5 has enabled interrupts,
conversions continue regardless of what other programs the user may be running (although
they should not interfere either with the location of the DAS20.BIN driver or the A/D data
area). For this reason it is termed a background operation and in most respects is
functionally similar to mode 6 (D.M.A.) although much slower. About 3000 samples/set. are
possible in mode 5.
The A/D will perform conversions on channels in accordance with the scan Queue that must
be set by mode
1. When the number of conversions "N" is larger than the number of items held in the Scan
Queue, the Queue resets after sampling it's final entry and begins sampling from Queue address
0 again.
The A/D may be triggered from 2 sources, the programmable interval timer or an external
trigger pulse according to DI0%(2). If the programmable interval timer is used, then EXT
TRIG acts as a start gate to the operation. If an external trigger is used, trigger pulses are
applied to EXT TRIG, positive edges start conversions.
On entry the following parameters should be initialized:-
MD% -7 5 (mode number)
DIO%(O) = Number of conversions required (Word count).
Range 1 to N, where N can range from 1 to
32766. When N is larger than the number of
items in the sample Queue, the program
automatically resets the Queue pointer, and
continues sampling.
DIO%( 1) = Segment of memory to receive data.
- ll-
DI0%(2) - Trigger source. There are 3 possible:-
DI0%(2) = 0 : External trigger input.
Conversions take place on
positive transitions on the
EXT TRIG input and continue
until the word count is
reached.
DI0%(2) = 1 : Programmable interval timer
with external gating: The
sample rate is set via Mode
24. EXT TRIG should be held
low until you want to start
conversions. Conversions will
begin as soon as EXT TRIG
goes high and continue until
EXT TRIG is brought low
again, or the word count is
reached.
DI0%(2) = 2 : Programmable interval timer
without external gating. The
sampling mode is set via Mode
24. Sampling begins (based
on Mode 24 sampling rate)
immediately upon excecuting
the Mode 5 call.
Since Mode 5 is a background task, the foreground program may stop the A/D collection
at any time by executing a Mode 11 call. If the Mode 5 operation is being internally paced,
Mode 26 (stop A/D clock) should also be called.
DI0%(3) - Single cycle/Re-cycle operation:-
DI0%(3) = 0 : Re-cycle. In this case data
is continuously written to
the same memory. DIO%(O)
corresponds to the memory
"buffer" length. The status
of the operation is 1 =
active until stopped by
mode 11.
DI0%(3) = 1 : One cycle. After completion
of the number of conversions
specified, interrupts are
disabled, setting the
operation status to zero.
DI0%(4) =X (value does not matter)
FLAG% = X (value does not matter)
- 12-
The following error codes apply to mode 5:-
FLAG% = 0 (no error, o.k.)
= -2 (driver not initialized)
= -1 (mode number out of range, CO or 729)
= 50 (Interrupt or D.M.A. already active)
=51 (number of conversions 0 or negative)
= 53 (Trigger input out of range)
=54 (Recycle flag not 0 or 1)
1.3.2.7 MODE 6: Multiple A/D samples with DMA data transfer.
Mode 6 performs "N" A/D conversions triggered either externally or by the programmable
timer, and at the end of each conversion, a direct memory transfer from the A/D to memory is
performed under the control of the IBM P.C. 8237 D.M.A. controller. This device transfers
the data from each conversion to a specified segment of memory and keeps track of the total
number of conversions performed without involving the 8088 CPU. When the number reaches
N, as specified by DIO%(O), D.M.A. transfers cease and a terminal interrupt is generated if in
the non-recycle mode (DI0%(3), or D.M.A. transfers are repeated continuously to the same
segment of memory if DI0%(3) specifies the re-cycle (auto-initialize) mode. Note that once
mode 6 has enabled D.M.A., conversions continue regardless of what other programs the user
may be running. D.M.A. is performed purely by the system and DAS-20 hardware, is a
background operation and is extremely fast. Throughput is limited by the speed of the A/D
converter and settling of the sample hold. Using the Harris HI-774 A/D converter, the DAS-20
can sustain a throughput slightly in excess of 100,ooO samples/set. A technical description of
the IBM P.C. D.M.A. arrangements is contained in Appendix E of the DAS-20 Manual.
The A/D will perform conversions on channels in accordance with the scan Queue set in mode
1. When the number of conversions "N" is larger than the number of items held in the Scan
Queue, the Queue resets after sampling it's final entry and begins sampling from Queue
address 0 again. If mode 1 has not been entered prior to mode 6, a FLAG% error will be
generated and no conversions will be performed.
NOTE: The DAS-20's input instrumentation amplifier has been designed for low noise,
high gain, and high speed performance. However, in order to minimize noise at high
gains, the input bandwidth has been reduced. To assure accurate readings the following
maximum sample rates at higher gains should be observed.
Input Range Maximum Recommended
sample rate
Oto 1ov 100,000 samples/set
-t/- 10 v 100,000 samples/set
+/- 5 v 100,000 samples/set
o-1 v 80,000 samples/set
+/- 0.5 v 80,000 samples/set
Oto 1OOmV 40,000 samples/set
+/-50 mV 40,000 samples/set
- 13-
On entry the following parameters should be initialized:-
MD% -7 6 (modenumber)
DIO%(O) -7 Number of conversions required (Word count).
Range 1 to N, where N can range from 1 to
32766. When N is larger than the number of
items in the sample Queue, the program
automatically resets the Queue pointer, and
continues sampling.
DIO%( 1) -7 Segment of memory to receive data.
DI0%(2) -7 Trigger source. There are 3 possible:-
DI0%(2) = 0 : External trigger input.
Conversions take place on
positive transitions on the
EXT TRIG input and continue
until the word count is
reached.
DI0%(2) = 1 : Programmable interval timer
with external gating: The
sample rate is set via Mode
24. EXT TRIG should be held
low until you want to start
conversions. Conversions will
begin as soon as EXT TRIG
goes high and continue until
EXT TRIG is brought low
again, or the .word count is
reached.
DI0%(2) = 2 : Programmable interval timer
without external gating. The
sampling mode is set via Mode
24. Sampling begins (based
on Mode 24 sampling rate)
immediately upon excecuting
the Mode 6 call.
Since Mode 6 is a background task, the foreground program may stop the A/D collection at
any time by executing a Mode 11 call. If the Mode 5 operation is being internally paced, Mode
26 (stop A/D clock) should also be cal.led.
- 14-
DI0%(3) -7 Single cycle/Recycle operation:-
DI0%(3) = 0 : Re-cycle. In this case data
is continuously written to
the same memory. DIO%(O)
corresponds to the memory
"buffer" length. This
corresponds to a D.M.A.
auto-initialize operation.
To end the acquisition, mode
11 must be run.
DI0%(3) = 1 : One cycle. After completion
of the number of conversions
specified, DMA ceases, an
interrupt is generated and
DMA is disabled, setting the
DMA status to zero.
DI0%(4) =X (value does not matter)
The following error codes apply to mode 6:-
FLAG% = 0 (no error, o.k.)
= 1 (driver not initialized)
=- (mode number out of range, =6; (Interrupt or D.M.A. already active)
= 61 (number of conversions 0 or negative)
= 63 (Trigger out of range)
Several details apply to the reliable use of mode 6. First, you cannot re-run mode 6 if a mode 5
interrupt or a previous mode 6 D.M.A. operation is still active. Error #60 will result. If you
request the recycle mode which generates continuous D.M.A. transfers, then mode 11 which
disables D.M.A. and interrupts must be run before you can succesfully run mode 6 again. If you
are in non-recycle mode, then it must have reached the word count which automatically disables
D.M.A. before mode 6 can be run again. On completion of a D.M.A. operation, the n-i-state
D.M.A. request (DRQ) drivers of the DAS-20 are placed in the high impedance state. This
allows more than one hardware device, or multiple DAS-20's to use the same D.M.A. level as
long as they do so sequentially.
Second, since the D.M.A. page registers cannot be incremented by the controller, the
maximum data area available is 64K (a page) for 32,767 conversions. Be sure that your data
area is not in use by your program or altered by subsequent operations. Also be careful that
your word count added to your segment will not cross a page boundary. This condition
which would otherwise cause a wrap round to the beginning of the page is detected by the
driver and produces error #67. To avoid this, a conservative rule is to use a segment that is also
a page boundary e.g. &HlOOO, &H2000 etc. Data may be retrieved using mode 13 during or
after the operation of mode 6 and mode 13 will not alter the memory.
Note that once DMA operation is initiated, it may well continue during or following execution
of the program. This is a "background" operation. Strange effects can occur if you
- 15-
inadvertently transfer data into your program area, be sure to use a free area of memory for
your DMA buffer. DEBUG can help you locate free areas, they are usually loaded with zeroes
on boot-up.
If you require to transfer more data than can be held in one 64K data segment, MetraByte is
currently in development of an optional data streamer software (STREAM-16) which has
been specially devised to perform continuous transfer through a D.M.A. buffer to hard disk.
With this software it is possible to continuosly stream "gapless" data to your hard disk at more
than 5OKHz on a PC/AT (somewhat slower on an XT). A standard 20 Megabyte hard disk will
hold about 3 minutes of data at 5OKHz. The maximum speeds attainable are dependent on the
type of your disk controller and manufacturer of your hard disk - contact MetraByte for
further information. Call MetraByte for availablility information on the STREAM- 16 package.
1.3.2.8 MODE 7: Command a Single D/A conversion
Mode 7 performs a write to one of the D/A converters.
MD% -7 7
DIO%(O) -7 D/A channel (0 or 1)
DIO%( 1) -7 D/A data (0 - 4095 for unipolar)
(-2048 to 2047 for Bipolar)
FLAG% = 0 (no error, o.k.)
= 1 (driver not initialized)
=- 1 (mode number out of range, =71 (D/A channel # not 0 or 1)
= 72 (D/A data out of range, 4095)
1.3.2.9 MODE 8: Load Memory Segment for D/A conversion.
Mode 8 has been developed to allow the user to load a segment of memory in preparation
for writing the data out to the DAS-20 D/A converters. Each conversion requires two bytes
of memory to be stored. This allows up to 32,768 conversions (single D/A), or 16,384
conversions (both D/A's) to be loaded into a 64 KiloByte page of memory.
Arguments:
MD%-7 8
DIO%(O) -> Number of Data words (conversions)
to transfer.
DIO%(l) -7 Memory Segment Address for raw data
- 16-
DI0%(2) -7 Starting offset for entering data
into the raw data buffer. DI0%(2)
will usually be 0, and the first
data word will be written into the
first buffer location. However, in
some instances, when data is being
taken from more than one array, it
is necessary to load one array into
memory, then load another array
immediately following the first.
DI0%(3) -> Pointer to array containing
the data to write to the D/As. The
pointer may be found by executing
the following instructions:
FLAG% <- Errors
FLAG% = 0 (no error, o.k.)
= 1 (driver not initialized)
=- (mode number out of range, ~0 or 729)
=8; (Word count zero or >32766)
=81 (Segment address out of range)
(Start offset out of range)
1;; (Data pointer out of range)
1.3.2.10 MODE 9: Multiple Interrupt D/A conversions
Mode 9 performs "N" D/A conversions based on interrupt control. Data is read directly
from memory (loaded by Mode 8) and written to the D/A converters. If Mode 8 was set to
load data for both D/A's than Mode 9 must also select two channel operation. However, if Mode
8 only loaded data for one D/A channel, Mode 9's channel select can select either D/A. The
update rate for D/A conversions can be set with Mode 25, or by an external signal.
The following variables are defined by Mode 9:
MD% -> 9
DIO%(O) -7 Number of conversions
DIO%( 1) -7 Segment address of buffer
- 17-
DI0%(2) -> Trigger source:
DI0%(2) =0 External trigger. A D/A
conversion is started on each
rising edge of the DAC TRIG
pin. (pin 29)
DI0%(2) = 1 Internal Trigger w/ external
gating. A conversion is
initiated based on the clock
rate set in Mode 25, and
gated by the EXT GATE pin.
DI0%(2) =2 Internal Trigger without
external gating. A
conversion is initiated based
on the Mode 25 clock rate.
DI0%(3) -7 Recycle flag
0 = restart on Nth conversion
X = terminate on X* cycle of
N conversions.
DI0%(4) -7 Channel select
0 = channel 0
1 = channel 1
2 = both channels
FLAG% <- Error Codes
FLAG% = 0 (no error, o.k.)
= 1 (driver not initialized)
=. (mode number out of range, =& (Interrupt already active)
=91 (Word count zero or 732767)
=92 (Buffer address out of range)
= 93 (Trigger source not 0, 1, or 2)
= 94 (Recycle flag out of range)
= 95 (D/A channel not 0,l or 2)
1.3.2.11 MODE 10: DMA driven D/A conversions
Mode 10 performs "N" D/A conversions based on DMA data transfers. Data is read
directlv from memory (loaded by Mode 8) and written to the D/A converters. If Mode 8 was set
to load data for both D/A's than Mode 10 must also select two channel operation. However,
if Mode 8 only loaded data for one D/A channel, Mode 10's channel select control can
select either channel 0 or 1.
The update rate of the D/A conversions can be set by the internal pacer clock (and Mode 25) or
can be synchronized to an external trigger.
- 18-
The following variables are defined by Mode 10:
MD% -> 10
DIO%(O) -> Number of conversions
DIO%( 1) -> Segment address of buffer
DI0%(2) -> Trigger source:
DI0%(2) =0 External trigger. A D/A
conversion is started on each
rising edge of the DAC TRIG
pin. (pin 29)
DI0%(2) = 1 Internal Trigger w/ external
gating. A conversion is
initiated based on the clock
rate set in Mode 25, and
gated by the EXT GATE pin.
DI0%(2) =2 Internal Trigger without
external gating. A
conversion is initiated based
on the Mode 25 clock rate.
DI0%(3) -> Recycle flag
0 = restart on Nth conversion
X = terminate on P cycle of
N conversions.
DI0%(4) -> Channel select
0 = channel 0
1 = channel 1
2 = both channels
FLAG% c- Error Codes
FLAG% = 0 (no error, o.k.)
= 1 (driver not initialized)
=- (mode number out of range, 20)
= lb0 (Interrupt already active)
= 101 (Word count zero or >32767)
= 102 (Buffer address out of range)
= 103 (Trigger source not 0, 1, or 2)
= 104 (Recycle flag out of range)
= 105 (D/A channel not 0,l or 2)
- 19-
1.3.2.12 MODE 11: Cancel DMA or Interrupt
Mode 11 causes an immediate disable of any rurl.ling interrupt or D.M.A. operation
initiated by modes 5,6,9 or 10. The operation will be abandoned at the time mode 11 executes.
On entry the following parameters should be initialized:-
MD%-> 11
DIO%(O) -> X (where X = any value)
FLAG% <- Errors (if any)
The following error codes apply to mode 11:
FLAG% = 0 (no error, o.kJ
=- 1 (mode number out of range, ~0 or >29)
1.3.2.13 MODE 12: Determine Status of interrupt/DMA
Mode 12 allows you to monitor the status of a background operation initiated by modes
5, 6,9 or 10.
Arguments:
MD% -> 12
DIO%(O) c- operation type in progress
0 - none
l-DMA,
2 - interrupt,
DIO%( 1) <- status of operation
0 - Done (finished)
1 - Active
DI0%(2) <- current word count
Number of conversions so far
The following. error codes apply to mode 12:-
FLAG% = 0 (no error)
= -2 (driver not initialized)
=- 1 (mode number out of range, ~0 or >27)
- 20 -
1.3.2.14 MODE 13: Transfer data from memory to array
Mode 13 transfers data from any segment of memory to integer array variables. Data in
memory derived from modes 5, 6 and 27 is in packed form consisting a word (2 bytes) of A/D
data + channel number.
Note how mode 13 functions. The number of words (or conversions) that you wish to transfer
to the data and channel arrays is set into DIO%(O). The segment of memory that you wish to
transfer data from is set into DIO%(l). Data can be transferred from the beginning of this
segment (DI0%(2) = 0) or any other point. A/D data is transferred to a dimensioned integer
array. The transfer will start at the pointer set into DI0%(3).
A/D data is shifted and also the MSB complimented if the DAS-20 is operating in bipolar mode.
In unipolar mode data ranges from 0 to 4095, in bipolar -2048 to +2047. The channel data is
masked out and ranges from 0 - 15.
Note that you must be careful about the transfer parameters. In particular:-
1: Do not transfer more words than an array will hold
or overun the end of the array. No checking is
performed to detect this condition which will
corrupt BASIC workspace and cause strange effects.
2: There is nothing to prevent you transferring
garbage from a source segment that does not
contain A/D data or from overrunning the end of
A/D data. No checking is performed to detect this
condition.
3: Due to the reformatting of data that this mode
performs, it is not a general purpose block move
utility.
On entry the following parameters should be assigned:-
MD% = 13 (mode number)
DIO%(O) -> Number of words to transfer (1 - 32767)
(Number of Scans if DI0%(5) > 0)
DIO%( 1) -> Buffer segment in memory (0 - 65536)
DI0%(2) -> Starting conversion number (0 - 32767)
(Starting Scan # if DI0%(5) > 0)
DI0%(3) -> Array Pointer (data)
DI0%(4) -> Array Pointer (channel)
(set = 0 if no channel data required)
DI0%(5) -> Unipolar/Bipolar Flag.
-2l-
= 0 (transfer unipolar data)
= 1 (transfer Bipolar data)
Since unipolar (o-4095) and Bipolar (-
2048 to +2047) data is in different
formats it is necessary to tell the
transfer routine which type of data is
being used. For channel scans which
include both unipolar and Bipolar either
format can be selected then scaled to the
correct form. The scaling conventions
are listed below:
Subtract 4096 from Bipolar data
transferred in Unipolar mode for data > 2047.
Add 4096 to Unipolar data transferred in
Bipolar Mode when value < 0.
DI0%(6) -> SSH-4,Flag. If the input data has been
acquired using the SSH-4, set DI0%(5) to
the number of channels in each scan.
This removes the Dummy first converseion
in each SSH-4 scan. Otherwise, DIO%(O) =
0.
FLAG% = X (value does not matter)
The following error codes apply to mode 13:-
FLAG% = 0 (no error)
= -2 (driver not initialized)
=- 1 (mode number out of range, CO or >29)
= 131 (word count, DIO%(O), zero or negative)
= 132 (buffer Segment out of range)
= 133 (start conversion number, DI0%(2), negative)
= 134 (DI0%(3) out of range)
= 135 (DIO%(4) out of range)
= 136 (SSH-4 Flag out of range)
Once data acquisition has been set up as a constant background operation using the recycle
options of mode 5 or 6, a foreground program can be processing the data as it is acquired using
mode 13 to retrieve the data. This is excellent for graphic and "digital oscilloscope"
applications.
- 22 -
1.X2.15 MODE 14: Read the Digital inputs
Mode 14 allows you to read the state of digital inputs DIN0 through DIN7. Data returned
can range between 0 and 255 corresponding to all combinations of the 8 input bits.
On entry the following parameters should be initiaiized:-
MD%=14
DIO%(O thru 4) - value does not matter
FLAG%=X - value does not matter
On return:
DIO%(O) contains input data (range 0 - 255)
DIO%(l thru 4) - unchanged
The following error codes apply to mode 14:-
FLAG% = 0 (no error, o.k.)
= -2 (driver not initialized)
= -1 (mode number out of range, 29)
1.3.2.16 MODE 15: Write to the Digital outputs.
Mode 15 is used to write digital data to the 8 bit output port, DOUTO through DOUT7.
Output data is checked to be in the range 0 - 255 and if not an error exit (error # 151) occurs.
On entry the following parameters shouid be assigned:-
MD%=15
DIO%(O) - output data (range O-255)
DIO%(l thru 4) - value does not matter
The following error codes apply to mode 15:-
FLAG% = 0 (no error, o.k.)
= -2 (driver not initialized)
= -1 (mode number out of range, CO or >29)
= 151 (output data ~0 or >255)
- 23 -
1.3.2.17 MODE 16: Analog trigger
Mode 16 provides an analog trigger function similar to an oscilloscope trigger. It is
sometimes useful to wait for a voltage to reach a certain level before starting to ga'&er data
and mode 16 provides this capability. Any of the analog input channels may be designated as a
trigger channel, and you may set the level and slope for triggering. The input range for the
analog triggering mode is always set at _+lOVolts, full scale.
The main use for mode 16 is in front of any of the other data acquisition modes as a gating or
wait loop until the specified analog trigger conditions are met. Since it is possible to get stuck
in the wait loop indefinitely if the trigger conditions are not fulfilled, you can also exit mode 16
by hitting any key which will return you to the calling program.
Parameters DIO%(O) thru DI0%(2) control the triggering and select the trigger channel number,
the trigger level and the trigger direction (slope). DIO%(O) specifies the trigger channel
number. It may be one of the scanned channels i.e. within the scan limits and carrying one of the
measured signals, or a separate channel outside the scanned channels used only for
triggering. The voltage level at which triggering occurs is set by DIO%(l) in bits, ranges of
-2048 to +2047 bits corresponding to bipolar input ranges. The direction of triggering or
slope is controlled by DI0%(2), for instance if DIO%(l) = 1024 on the +/-1Ov range the trigger
level will be +5.OOV and if DI0%(2) = 0 (positive slope) triggering will take place when the
signal exceeds +5.OOV, alternatively if DI0%(2) = 1 (negative slope) triggering would take
place when the trigger signal becomes less than +5.0 Volt.
On entry the following variables should be initialized:-
MD%=16
DIO%(O) = Channel number (0- 15)
DIO%( 1) = Trigger level
(-2048 to +2047 bits)
DI0%(2) = Slope (0 = positive, 1 = negative)
DI0%(3) thru DI0%(4) - value irrelevant
The following error codes apply to mode 16:
FLAG% = 0 (no error, o.k.)
= -2 (driver not initialized)
=- 1 (mode number out of range, 24)
= 160 (Trigger aborted by Keyboard)
= 161 (trigger channel out of range)
= 162 (trigger data out of range
~2048 or >2047
= 163 (slope data not 0 or 1)
- 24 -
1.3.2.18 MODE 17: Initialize Timer - Reset timer.
Set counters 3, 4 & 5 to ADC time delays. The AMD9513 counter timer operation are
discussed in much greater detail in chapter 7, and Appendix F of the DAS-20 manual.
Arguments:
MD% -> 17
DIO%(O) -> Don't Care
FLAG% <- Errors (if any)
=o (No errors)
= -1 (Mode # out of range)
1.3.2.19 MODE 18: Set Timer Master Mode Register
Mode 18 sets the AMD9513 to a user specified configuration. Data bus width set to 8
bits, Data pointer auto increment enabled, Binary division. The AMD9513 counter timer
operation are discussed in much greater detail in chapter 7, and Appendix F of the DAS-20
manual.
Arguments:
MD% -> 18
DIO%(O) -> Fout divider ratio (1 - 16)
DIO%(l) -> Fout source
O=Fl
1 = Source 1
2 = Source 2
3 = Source 3 I
4 = Source 4 I No Connection
5 = Source 5 I
6 = Gate 1
7 = Gate 2
8 = Gate 3 I
9 = Gate 4 I No Connection
10 = Gate 5 I
11 =Fl
12=F2
13=F3
14 = F4
15 =F5
- 25 -
DI0%(2) -> Compare 2 disable/enable (O/l)
DI0%(3) -> Compare 1 disable/enable (O/l)
DI0%(4) -> time of day mode control
0 = TOD disabled
1 = TOD Enabled /5 input
2 = TOD Enabled /6 input
3 = TOD Enabled /lO input
FLAG% <- Errors
=o (No error)
= -2 (Driver not initialized)
= -1 (Mode out or range CO or >29)
= 18 1 (DIO%(O) out of range)
= 182 (DIO%( 1) out of range)
= 183 (DI0%(2) not 0 or 1)
= 184 (DI0%(3) not 0 or 1)
= 185 (DI0%(4) out of range 3)
1.3.2.20 MODE 19: Set Counter `N' Mode Register
Mode 19 sets counter N to to user specified value. The AMD9513 counter timer operation
are discussed in much greater detail in chapter 7, and Appendix F of the DAS-20 manual.
Arguments:
MD% -> 19
DIO%(O) -> Counter Number (1 - 5)
DIO%(l) -> Gating Control (0 - 7)
0 = No gating
1 = Active high level TCN-1
2 = Active high level Gate N+l
3 = Active high level Gate N-l
4 = Active high level Gate N
5 = Active low level Gate N
6 = Active high edge Gate N
7 = Active low edge Gate N
DIO%(2) -> Count Edge positive/negative (O/l)
- 26 -
DI0%(3) -> Count Source Selection (0 - 15)
O=TCN-1
1 = Source 1
2 = Source 2
3 = Source 3 I
4 = Source 4 I No Connection
5=Source51
6 = Gate 1
7 = Gate 2
8 = Gate 3 I
9 = Gate 4 I No Connection
10 = Gate 5 I
11 =Fl
12=F2
13=F3
14=F4
15=F5
DI0%(4) -> Disable/Enable special gate (O/l)
DI0%(5) -> Reload from Load/ReIoad from Load
or Hold (O/l)
DI0%(6) -> Count once/Count repetitively (O/l)
DI0%(7) -> Binary counVI3.C.D. count (O/l)
DI0%(8) -> Count down/Count up (O/l)
DI0%(9) -> Output control (0 - 5, except 3)
0 = Inactive
1 = Active high terminal count pulse
2 = Terminal count toggled
3 = *** Illegal ***
4 = Inactive, output high impedence
5 = Active low terminal count pulse
FLAG% c- Errors
FLAG% <- Errors
=0 (No error)
= -2 (Driver not initialized)
= -1 (Mode out or range CO or >29)
= 181 (DIO%(O) out of range cl or >5)
= 182 (DIO%(l) out of range CO or >7)
= 183 (DI0%(2) not 0,or 1)
= 184 (DI0%(3) out of range 15)
= 185 (DI0%(4) not 0 or 1)
= 186 (DI0%(5) not 0 or 1)
= 187 (DIO%(6) not 0 or 1)
= 188 (DI0%(7) not 0 or 1)
= 189 (DI0%(8) not 0 or 1)
= 180 (DI0%(9) not 0, 1,2,4 or 5)
- 27 -
1.3.2.21 MODE 20: Set Multiple Counter Control Registers
- To user specified value. The AMD9513 counter timer operation are discussed in much
greater detail in chapter 7, and Appendix F of the DAS-20 manual.
Arguments:
MD% -> 20
DIO%(O) -> Command (1 - 6)
1 = Arm selected counter
2 = Load source to counter
3 = Load and arm counter
4 = Disarm and save counter
5 = Latch counter to hold register
6 = Disarm counter
DIO%(l) -> Select Counter 1 (O/l)
DI0%(2) -> Select Counter 2 (O/l)
DI0%(3) -> Select Counter 3 (O/l)
DI0%(4) -> Select Counter 4 (O/l)
DI0%(5) -> Select Counter 5 (O/l)
FLAG% <- Errors (if any)
=o