Tektronix DAS-4 User guide

DAS-4
Part
DAS-4
24888
Last
Copyright
KEITHLEY
440
Taunton,
METRABrrUASYSTlDAC
Myles
Telephone
FAX
Revision
Edit:
Standish Boulevard
Massachusetts
A
July,
1987
@
1987
02780
5081880-3000
508/880-0179
WARRANTY INFORMATION
All
products manufactured
and
worksmanship for a period of one year
purchaser.
Any
product that
option of Keithley MetrdByt'e,
by
Keithley MetraByte are warranted
is
found to be defective
be
repaired
products damaged by improper use.
hm
or
replaced.
the date
within
This
against
of
delivery to the ongind
the
warran@
warran@
defective materials
period
does
not
will,
apply to
at
the
New Contact Information
Keithley Instruments, Inc.
28775 Aurora Road
Cleveland, OH 44139
Technical Support: 1-888-KEITHLEY
Monday – Friday 8:00 a.m. to 5:00 p.m (EST)
Fax: (440) 248-6168
Visit our website at http://www.keithley.com
Table
of
Contents
...
Section 1 INTRODUCTION 1-
1.1
SUMMARY
Section 2 INSTALLATION 2- 1
2.1
BACKING UP
2.2
HARDWARE
Section 3 PROG€L"G
3.1
PROGRAMMING DAS-4
3.1.1
3.1.2 STARTING
3.1.3 READING
3.1.4
3.1.5
3.1.6
3.2 LOADING "DAS4.BIN"
3.3 FORMAT OF
3.4 EXAMPLES
3.5 MODEO- INITIALIZE
3.6 MODE
3.7 MODE
MUX
3.8 MODE
3.9 MODE MEMORY ON INTERRUPT
3.10 1
3.1
3.12 MODE
3.13 MODE
3.14 MODE
3.15 SUMMARY OF ERROR CODES
3.16 PROGRAMMING EXAMPLES
3.17 OTHER PROGRAMS AhD UTILITIES
3.18 ASSEMBLY LANGUAGE PROGRAMS AND CALLS
LANGUAGES
3.19 A NOTE ON EXECUTION TMES
3.20 MULTIPLE DAS-4's
I/O
THE THE
SOME
.....................................................
MODE MODE
OF DAS-4 FUNCTIONS
THE
DISK
INSTALLATION
.................................
........................
............................
..................................
ADDRESS MAP
THE
THE
DAS-4 STATUS REGISTER DAS-4 CONTROL REGISTER
BASIC PROGRAMMING TIPS
THE
MACHINE LANGUAGE CALL ROUTINE
OF
DAS-4
A/D
CONVERTER
A/D
DATA
........................
....................
...........................
......................
....................
..................
................................................
THE
OF
CALL STATEMENT
THE
USE
OF
THE CALL ROUTINE 3-12
.....................
.........
..................................
1
.
SET MULTIPLEXER SCAN LIMITS
2
.
DO
ONE
A/D
CONVERSION
3
.
DO
N
AJD
CONVERSIONS DIRECT TO ARRAY
4
.
DO
N
A/D
CONVERSIONS
AND
AND
..............
INCREMENT
TRANSFER TO
..................................
5 . ANALOG TRIGGER FUNCTION
6
.
TRANSFER DATA FROM MEMORY TO ARRAY . 3-25
7 - READ
8
.
READ DIGITAL
9
.
WRITE DIGITAL OUTPUT
STATUS
..............................
INPUTS
IP1-3
OP1-4
................
.................
...............
.........................
FOR
THE DRIVER MODES
....................
IN
OTHER
.............................................
.
IN
ONE SYSTEM
COMPILED BASIC
....................
......
...
.
3-13 3-15
3-17 3-19
.
1
1-1
2-1 2-1
3-
1 3-1 3-2 3-2 3-3 3-3 3-4 3-5
3-6 3-9
3-21 3-23
3-27 3-28
3-29 3-30 3-31
3-31 3-32
3-32 3-33
.
Section 4 APPLICATIONS
4.1 CHANNEL INPUTS
4.2 MEASURING VOLTAGE
4.3 4-2OmA CURRENT LOOPS
4.4 THE REFERENCE
4.5 USING DIGITAL INPUT/OUTPUT
4.6 ADDING
MORE
......................................
.................................
.......................................
ANALOG INPUTS
................................
.........................
........................
1
4-
1 4-1 4-2
4-4 4-4
4-4
4-5
4.7
INTERFACE TO TRANSDUCERS, THERMOCOUPLES ETC.
4.8 POWER OUTPUT
4.9 PRECAUTIONS IN USE - NOISE, GROUNDLOOPS
OVERLOADS
..............................................
FROM
THE
DAS-4 CONNECTOR
..........
AND
...
4-5
4-6
4-6
Section 5 CALIBRATION AND TEST
AND
5.1 CALIBRATION
5.2 SERVICE AND REPAIR
5.3
TECXNICALASSISTANCE
Appendix
A.1 MAINI/OCO"ECTOR
A.2 REAR
Amendix
AA
B.l POWER CONSUMPTION B.2
B.3 B.4 SAMPLE
B.5 B.6
B.7
B.8 POWEROUTPUTS B.9 GENERAL ENVIRONMENTAL
Appendix C STORAGE
A
CONNECTIONS A- 1
VIEW
B
SPECIFICATIONS
ANALOG
A/D
SPECIFICATION
OF
INPUT
HOLD
REFERENCE VOLTAGE DIGITAL INTERRUPTINPUT
I/O
...........................................
TEST
..................................
.................................
DAS-4
CONNECTOR
.................................
SPECIFICATIONS
....................................
AMPLIFIER..
OUTPUT
.....................................
......................................
OF
INTEGER VARIABLES
...............................
...............................
......................
.......................
............................
.........................
...........................
5- 1 5-1 5-1 5-1
A-1 A-3
--
B-
1
B-1 B-1
B-1 B-2 B-2 B-2 B-3 B-3
B-3
c-
.
1
..
11
DAS-4
MANUAL
INTRODUCTION
Section
1
INTRODUCTION
1.1
MetraByte's
IBM
6300 series, Zenith, Compaq, PC's Limited, Tandon, Televideo etc. The
and can be connector that projects through the rear of the computer. The following functions are implemented on the
1.
2.
SUMMARY
PC-PC/XT-PC/AT & PS2 Model 30 P and other bus compatible computers e.g. A.T.&
DAS-4
fitted
is a 8 channel 8 bit hi h speed
in a
OF DAS-4
"half'
slot. All connections are made through a standard .37
FUNCTIONS.
A/D
converter and digital
I/O
DAS-4
board for the
board is
pin
DAS-4:-
An
8
channel, 8 bit successive approximation
+/-5
volts
input of each channel is are single ended volts and brief transients of several when the computer power is off. microseconds
30,000
7 bits of port
channels/sec
TTL
of
3
bits.
with
max.)
and depending on the speed of the software driver, through puts of
are
digital
VO
a common ground and can withstand a continuous overload of
attainable.
are provided composed of one output port
with
a resolution of 0.03906 volts
hundred
A/D
AD
converter with samplehold. The full scale
volts. All inputs are fail safe
conversion hme is typically
(39.06
20
of
4
millivolts). Inputs
i.e.
open circuit
microseconds
bits and one input
5"
D
+/-30
T.
long
male
(30
up
to
1
precision
3.
reference. This output
A/D
Full
4.
An external interrupt input is provided that can select any of the and allow user programmed interrupt routines to provide background data acquisition interrupt driven control. The DAS-4 includes status and control registers that make intempt handshaking a simple procedure. The connected to any external
IBM
5.
The following utility software for 5-1/4" floppy request)
1. A machine language
1.
Registered
P.C. bus power rear connector. This makes for simple addition conditioning circuits, expansion multiplexers etc.
:
-
110
channel functions via BASIC CALL. The I/O driver can select
trademarks
+5.OOv
Scale
disk
of
(+/-O.~V) reference voltage output is derived from the
can
trim
source/sink
pot.
5mA
and
is
the voltage
is
IBM
'ITL
(+5,
+12 & -12v) is provided along with
compatible with
I/O
driver (DAS4.BIN) for control of
International
Business
interrupt
compatible trigger source.
DAS-4
Machines
is provided
DOS
2.0 and higher revisions (3-1/2" media available on
Corporation.
input is positive edge triggered and may
all
other
of
user designed interfaces,
on
a double sided 360K PC-DOS format
AD,
and digital
A/D
converter
slightly adjustable
P.C. interrupt levels 2-7
YO
connections
input
by
the
or
be
on
the
signal
INTRODUCTION
DAS-4
MANUAL
multiplexer channels, set scan limits, pexform conversions, interrupt driven conversions and scans. The driver source
is
listing, DAS4.ASM,
2. Initial setup and installation aids.
3. Calibration and test programs.
4.
Electronic strip chart program.
5.
Slow
speed data logging program.
6. Other examples and demonstration programs. The DAS-4 is simple, inexpensive and easy to use.
acquisition and control applications. 8 bits provides a span
corresponding to than 1% bipolar resolution which is often adequate for many measurement, control and graphing applications. The DAS-4 is hardware compatible with MetraByte's DAS-8 which provides higher resolution through
To
extend the capabilities of DAS-4 the following expansion modules can
insulation displacement cable
SCREW "AL CONNECTOR BOARD
1.
connected to miniature screw terminal connectors. The digital monitored available for amplifiers, filters, and other user supplied circuits. The screw terminal connector board is MetraByte part number STA-08.
-5
by
L.E.D.'s and a small bread board area with +/-12v & +5v power is
also provided
volts of input, and +127 corresponding to +4.96 volts.
the
use of a 12
to
the main
on
the disk.
bit
A/D.
37
pin
software commanded
It
is ideally suited to low precision data
D
VO
connector:-
-
All
VO
lines on the rear connector are
of
AD
255 bits with -128 bits
This
provides better
be
connected via flat
YO
port lines
are
EXPANSION MULTIPLEXER
2. EXP-16 multiplexes 16 differential inputs to a single analog output suitable for
to
any
of
connection cascadable so that up to
total
a instrumentation amplifier 200
sensor is also included directly connected
resolution of a
ISOLATION AMPLIFIER
3. channels and measuring off ground voltages protecting input circuits. Up to 32 The ISO-4 also includes cold junction compensation and can be used measurements. The
MetraByte also offers many optional software packages that can enhance DAS-4. Their menu driven user interfaces eliminate programming and give fast results. Most include the capability of generating data and some also provide analytical capabilities as well. For a full description, see our catalog. All of ACQUIRE, LABTECH STORAGE SCOPE,
of 128 channels. The expansion multiplexer board includes a low drift
or
1000
(other
12
can
our
software that works
the analog input channels of DAS-4. EXP-16 boards
8
EXP-16
with preselected switchable gains of
gains
can
for software compensation of thermocouples which can be
to
EXP-16, although the DAS-4 resolution will not provide the fine
bit
A/D
board when used for thermocouple measurements.
be
connected directly to DAS-4. This
ISO-4
provides gains ranging from
NOTEBOOK,
?TOOLS
AND
be
resistor programmed). A cold junction compensation
-
MetraByte's model ISO-4 provides 4 isolation amplifier
(500v
Lotus
with
DAS-8 will also
and CTOOLS.
INSTRUMENTATION AMPLIFIER - The
boards can be attached to a single
is
an
max. isolation) or eliminating ground loops or
IS04
expanders may
1-2-3 compatible data files, immediate graphing
work
UNKELSCOPE, UNKELSCOPE
be
connected to one DAS-4.
1
to
1000.
with DAS-4 and includes LABTECH
DAS-4
0.5,
1,
excellent accessory for
for
providing
2,
10,
thermocouple
the
ease
JR.,
50,
of
SNAPSHOT
are
100,
use of the
of
1-2
-
DAS-4 MANUAL
Section
I
NSTAL LATlO
2.1
The utility software supplied with DAS-4 is compatible Model 30 drives, please contact MetraByte, it is available at no charge. It is advisable to make a back up copy before using the software. For a direct back up, use the DOS DISKCOPY utility or alternatively COPY to a directory of your choice, the DAS-4 utility software is not copy protected. you should misplace or damage the disk, please contact MetraByte for a free replacement.
BACKING
with
DOS
2.0
*.*
to a pre-formatted disk. For a hard
UP
THE DISK
thru
3.3 revisions.
If
you need a 3-1/2” disk compatible with the PS2
2
N
in
DOS 2.0 (360K DSDD) format which is
disk,
simply use COPY
INSTALLATION
*.*
to transfer
If
for any reason
2.2
DAS-4 utilizes 4 consecutive address locations in used by internal DAS-4’s
anywhere in the I.B.M. space extends be fully occupied.The PC AT’S
100-3FF), some space also allows use of more than one DAS-4 for standard lBM devices are detailed below:-.
HARDWARE INSTALLATION
VO
and your other peripheral cards,
I/O
address can be set by the
PC decoded
fiom
decimal 512-1023 (Hex 200-3FF) which is much larger than is ever likely to
XT
compatibles
ADDRESS(Hex1 DEVICE ADDRESS(Hex1 DEVICE
000-
1
FF
200-20F 2 10-2 17
220-24F 278-27F 2FO-2F7 2F8-2FF 300-31F 320-32F
Internal system
Game Expansion unit Reserved Reserved LPT2: COM2: Prototype card
disk
Hard
BASE
I/O
VO
address space is larger and extends from 256-1023 (Hex
also
follow this expanded
ADDRESS D.I.P. switch to be on a 4 bit boundary
space. The PC and PC/XT’s expansion
in
378-37F 380-38C 380-389 3AO-3A9
3BO-3BF 3CO-3CF 3DO-3DF 3EO-3E7 3FO-3F7 3F8-3FF
VO
space. Some
so
to avoid conflict with these devices,
VO
a single computer. The reserved
I/O
addresses
space capability. Such a large
LPT1: SDLC comm. Binary comm. Binarycomm. Mono dsp/LPT Reserved
Color graphics Reserved Floppy disk COM1:
2
1
1
:
will
already be
UO
UO
address
addresses
the
This covers
1/0
peripherals e.g. special hard disk drives, special graphics boards, prototype cards etc. they
may
be making use
standard
of
IBM
I70
options (most compatibles are identical),
I/O
addresses not listed in the table above. Memory addressing is separate
but
if
you
have other
2-
1
INSTALLATION
from
I/O addressing computer. Usually, a (Decimal Hex
300-3
768
or
784). (Note
1F
address space and would conflict,
so
there is no possible conflict with any add-on memory that may
good
choices is to put the DAS-4 at base address Hex
if
you have an
IBM
prototype board plugged in,
&H330
or &H340 would be a good alternative
DAS-4
&H300
it
MANUAL
be
in
or
&€-I310
makes use of the
your
in this case). As an aid to setting the base address D.I.P. switch, a graphical switch position display program, INSTALL.EXE, can be run
the DOS prompt.
To
run
the installation aid program,
from
type:-
A>INSTALL
When you get the "Desired base address?" prompt,
will
format and press return. The program check for possible conflicts with standard
the
picture of understand
correct positions of the toggles
the
details, see Fig.
2.1
for an explanation of base address switch settings. Set the
round your address to the nearest 4 bit boundary,
IBM
YO
on
the base address DIP switch.
your choice in decimal
devices (and warn you
if
so)
or
&H---
and draw a
If
you like to
type
in
DAS-4 base address dipswitch to correspond with your choice. The
only
other setting on the DAS-4 is the choice of-'hardware intempt level.
going to use interrupts in your progamming (mode
jumper can
a level that
be
left in the
is
not in use by any other peripheral board (see Section 3.5, mode
"X"
(inactive) position.
If
you intend to use interrupts, set the jumper to
4
of
the DAS4.BIN driver) the interrupt
If
you are not
0
for more
information).
To
install the
"Guide
to Operations" manual for your computer if you are not already expert at this maneuver).
Remove a vacant back plate by undoing the screw at the top and plug the DAS-4 the backplate. The board should not
board,
be
placed in the short slot next to the power supply on a
TURN
will
OFF
fit
THE
POWER
in
any of the slots
on
your computer and remove the case (See the
of
the
IBM
PC,
in
XT
or Portable computer
PC/XT.
This slot is intended
and secure
but
for the expansion interface and has slightly different signals from t5e others, DAS-4 will not work properly into any socket but
is
now complete.
although
it
will
You
it
will
not cause any damage. On the PC/AT, DAS-4 can
not make use
of
the extended
AT
bus interface connector. Installation
be
plugged
may plug any of the DAS-4/8 accessories or your own cable into the
37
in
it
pin D connector on the rear.
Remember,
including
can cause costly damage
BASE ADDRESS
98765432 (DECIMAL
........
........
........................
.......
.......
.......
.............................
......
......
......
..................................
.....
.....
.....
.......................................
....
....
....
............................................
...
...
...
.................................................
..
..
..
......................................................
...........................................................
TURN
fhe
DAS-4.
OFF
Never
THE
POWER
try
to
install
to
the electronics
SHOUN
ADDRESS EQUIVALENT
whenever installing
or remove any peripheral
of
your computer and/or the DAS-4 board.
SET TO
A2 A3
A4
A5
A6
A?
A8
A9
hH300
768)
DEC
16
128
256
512
I
MAL
4 8
or
removing any peripheral board
board
VALUE
VALUE
ON
POSITION
with the power on as it
IN
OFF
POSITION
IS
ZERO
IN
THE
234
I
NTERRVPT
2-2
567X
LEVEL
FIG.
INTERRUPT
PLFICE
"
X"
-
2.1
JUMPER
JUMPER ON
I
NACT
I
VE
6ASE
~ICIDRESS
BLOCK
LEVEL SELECTED
PARK
I
NG
POS
I
TI
d
iNTERRUPT SELECTION
ON
PROGRAMMING
Section
3
PROGRAMMING
3.1
At
-
BASIC these level languages have equivalent instructions functions demanding, this can require many lines data format and architecture routine "DAS4.BIN" is included BASIC by a single line CALL statement and covers the majority of common operating modes. The various modes of
check data, and perform frequently performs read data and increment the multiplexer.
Using the DAS4.BIN driver saves a lot of programming time and has some other benefits as well. For instance, the driver supports data collection on interrupt from an external source. Note that BASIC has no intempt processing functions and
using these methods is only available using
PROGRAMMING DAS-4
the lowest level, DAS-4 can
are
the
INP
@)
usually
a
involves formatting data and dealing with absolute
the
CALL routine select all the functions
sequence of operations required to perform an
be
and
OUT
of
the DAS-4.
in
used
programmed
of
the DAS-4 software package. This may
using
X,Y
functions. Assembly language and most other high
(IN
code and necessitates an understanding
To
simplify program generation, a special
sequences
the
of
CALL routine.
YO
input and output instructions. In
AL,DX and
instructions. An example is Mode 2 which
so
called "background" data collection
OUT
of
MI
conversion, check
DX,AL). Use of these
VO
addresses. Although not
the DAS-4, format and error
of
be
accessed
the devices,
A/D
I/O
driver
from
status,
INP
Both methods of programming using same result, and
the
CALL routine much simpler to implement. If you need non-sequential channels, special interrupt routines etc. you can modify the DAS4.BIN driver to your requirements. The fully commented assembly source is supplied on the utility
(DAS4.ASM) and can is
a good starting point for assembly language programmers who wish to modify
driver. For the steps involved in generating a BLOADable DAS4.BIN
instructions prompt).
in
you
are free to choose either although usually
be
re-assembled using the Microsoft Macro-Assembler (any version) and
the
file HOWTO.BIN
and OUT functions and the CALL routine achieve the
the
BASIC proFammer will find
to
perform specialized scans such
the
file,
follow the
file
on the disk (enter
TYPE
HOWTO.BIN after the DOS
as
disk
standard
3-
1
PROGRAMMING
DAS-4 MANUAL
3.1.1
IIO
ADDRESS
First
of
all let’s
take
ADDRESS
Base Address
The
DAS-4
addresses, but the register format and functions are identical. compatibility with MetrdByte’s model with existing software e.g. Labtech Notebook etc. that has drivers for the
3.1.2
STARTING
has
MAP
a look at the
+
+1
+2
+3
an
VO
address map that is a subset of the
THE
AID CONVERTER
OF
0
DAS-4
VO
address map
READ
Always zero
A/D
data Status register Control register Status register
(same as Base
of
the
DAS-4:-
(8
bit) Start
+
2)
WRITE
Start
12
bit
AD AD
DAS-8,
This
DAS-8,
12
bit
AJD
board,
so
conversion conversion
that the
it uses only the fust
is to maintain hardware
DAS-4
can
be
4
used
DAS-8.
An A/D ADDRESS
any case. The ensuing can
The
is that
It
is a good precaution
write
Starting
conversion is initiated by writing to either location
+
1.
The value of any data written to these locations
be
monitored
DAS-4
it
will
to
BASE ADDRESS
an
A/D
from
uses the
not
start
conversion:-
AD7574 8
xxxl0
or:-
xxxl0
A/D
conversion will take about
bit
7
of
the status register.
bit
A/D
converter. One of the design “features” of this converter
another conversion until data
to
perform a read of the
to
start a new conversion.
OUTBASADR%, OUTBASADR%
+
0
1,
AD
0
BASE
20
microseconds to complete, its progress
from
the
previous conversion has been read.
and throw away the data before issuing a
ADDRESS
is
irrelevant and will
+
0
or
be
BASE
lost
in
3-2
DAS-4
MANUAL
PROGRAMMING
3.1.3
READING
After the end
+
1.
The data format is:-
-
BIT POSITION
(BASE ADDRESS + 1) B1 B2 B3 B4 B5 B6 B7 B8
Location compatibility
The
BINARY
0000 0000
0100
BASE ADDRESS + 0
A/D
data
OOOO
0001
0000
THE
AID DATA
of
conversion the data
-
D7
(MSB)
with
the
12
bit
A/D
bits
B 1-B8
HEX
correspond to
DECIMAL ANALOG
00
01
40
0
1
64
from
the
A/D
may
be
read
from
location
-
D6
will always return zero when read, this is to maintain
data
of
-
D5
the
DAS-8.
an
offset binary code:-
_.
D4
-5.000
-4.961
-2.500 v (-1/2
-
D3
INPUT
v
(-Full
v
D2
VOLTAGE
scale)
scale)
BASE ADDRESS
D1
DO
1000
0000
1000
0001
1
loo
0060
iiii
iiii
A
sequence of
xxxl0 INP(BASADR% + l),
XXX~O
3.1.4
The
I/O BIT POSITION
THE DAS-4 STATUS
status register provides information on the operation of
location
(BASE ADDRESS
BASE ADDRESS
80
81
CO
*
FF
BASIC
V = (D%-128)*5/128
+
2) EQC
128 129
192
255
instructions to read the data and
D%
REGISTER
+
2
(or
BASE ADDRESS + 3)
-
D7
-
D6
IP3
-
D5
IP2
+/-0
v (zero)
4.039
+2.560
~4.961
'read data 'scale to volts
v
v
v
turn
it into volts
-
D4
LP1
(+1/2
(+Full
in
DAS-4.
and
bits
has
-
D3
IRQ
scale)
scale)
would
It is a read only register at
the
D2.
34A2 MA1
be:-
following format:-
D1
-
DO
MA0
The bits have the following significance:-
PROGRAMMING
DAS-4
MANUAL
EOC:
IP3
-
IP1:
IRQ:
MA2-MAO:
End of Conversion.
A/D
is busy performing a conversion. Data
should not
invalid. Wait for the
sigmfying valid data available.
These bits correspond to the three port lines for any
After generation of an interrupt to the processor
IRQ
is
(0)
low provides a means
"handshaking"
These bits provide the current analog multiplexer channel address as follows:-
MA2
be
IP3,
digital
set to logic high
by a write
MA1 MA0 CHANNEL
0 0
1
1
If
EOC
is
high
(Logic
read
in
this
condition
EOC
to
return
digital
IP2 and IP1. They may
input data.
(1).
It
is reset
to
DAS-4
the control
of
acknowledging or
interrupts.
register.
0
1
0
1
as
to
it
1)
will
logic
input
be
used
to
logic
This
the
be
0.
0 0
0
1
1
1
0
1
3.1.5
The control register sets the multiplexer (channel) address, enables and disables intempts and provides output data to the write only register located at
The data format of the control register is:-
-
BIT POSITION (BASEADDRESS+2)
The bits have the following significance:-
THE
DAS-4 CONTROL
OP4-OP1: These bits correspond to the four general purpose
REGISTER
4
general purpose digital outputs OP1-OP4. The control register is a
UO
address
-
D7 OP4 OP3 OP2 OP1
digital output lines OP1 thru can be used for external control functions e.g. driving an input sub-multiplexer to increase the
number mux. expand the system to 128 channels.
of
on
BASE ADDRESS + 2 (same location as
-
D6
analog input channels. A
each
-
D5
of
DAS-4's 8 analog channels can
-
D4
OP4.
-
D3 INTE
These lines
16
channel
status
D2-
MA2
D1 MA1
register).
DO
MA0
3-4
DAS-4
MANUAL
PROGRAMMING
INTE:
MA2-MAO:
DAS-4
of the selected
INTE
INTE
,
input (pin level and are positive edge triggered. programmer's responsibility to set up an interrupt handling routine, intempt vectors and initialize the
IBM
register will clear the register.
These bits select the current analog multiplexer channel address as follows:-
generated interrupts are enabled onto
IBM
P.C.
interrupt levels
=
1
(logic high). Interrupts are disabled if
=
0
P.C.
MA2
(logic low). Interrupts
24)
are passed through to the selected
8259
processor board. Writing to the control
interrupt controller
IRQ
MA1
MA0
from
bit
of
CKANNEL
the
It
the
2-7
INT.IN
is the
on
any
if
the
status
The multiplexer channel address One further note about the control register. During power up
line of the IBM interrupts are disabled, sets address to zero.
3.1.6
programming, but may
SOME
Some BASIC commands which
Data read
ANDed
until a non-zero result is obtained. This is an excellent way program
This command
with
checks the timer
P.C.
is
asserted, the DAS-4 control register is cleared. This insures that
BASIC
a pseudo-interrupt. After execution
PROGRAMMING
be
useful with
WAIT
with
wait
ON
port, n[,m]
at
the port
"n".
If
until some desired external condition is attained.
TIMER
is
only available in DOS
to
can
be
determined at any time by reading the status register.
digital
outputs
OP1-4
to zero and sets the multiplexer channel
TIPS
you
may not have used frequently in the come
DAS-4
is
exclusive-or'ed (XORed) with integer expression "m" and
the result is zero, BASIC
(n)
GOSUB
see
if
the condition >n
line
are:-
2.0
loops
and above. In effect
of
each BASIC statement, BASIC
(
1
<
n
<
86,400
of
the
IBM
back and tests
of
seconds) is satisfied.
P.C.
the
making
it
provides
when the
of
port again
your
you
If
RESET
DAS-4
ordinary
3-5
PROGRAMMTNG
it
is, control passes
polling of the timer
TIMER ON
Trapping is disabled by:-
to
the subroutine, otherwise the next line
is
called trapping and is activated by:-
is
executed.
DAS-4
MANUAL
This
3.2
TIMER
Note that trapping only occws while your BASIC program is executing (unlike a true interrupt) and can execution time. is a convenient way
If
you
wish to program an than the more powerful CALL routine, the following sequence should followed:-
xxxl0
xxx20
xxx30 D%=INP(BASADR%+l) 'read
Note that looping while the in interpreted BASIC conversion time of compiled using the BASIC COMPILER, the execution time is reduced to a point where the status test
line
xxx30.
OUT
IF
LOADING THE
OFF
be
slightly delayed by statements that require a
If
you
need
to
sample
to
do
it.
A/D
BASADR%
INP(BASADR%+2)>=&H80
as
20
of
+1,0
A/D
the interpreter execution time greatly exceeds the
microseconds. However,
line
xxx20
at
long intervals the
conversion using BASIC
converter is still busy (line.
is essential
MACHINE
ON
TIMER command
INP
and
OUT
'start
A/D
conversion
GOT0
xxx20 'status test loop
A/D
data
xxx20)
if
the program is subsequently
to
avoid returning enoneous data in
is not required
LANGUAGE CALL
lot
of
rather
be
A/D
ROUTlN
As
the previous simple example tedious to implement although a lot of the required programming could subroutines. Use
circumvents the execution time delays of interpreted or compiled BASIC, and
background data collection using intempts.
In
order
You
must avoid loading BASIC (watch out for BASICA.EXE if you Disk". work and damage will result, but to get things going again you seconds before turning
in
general and would apply to loading any CALL or information provided
When you load the DAS4.BIN CALL routine, you have two options depending on the size of
your
If
them,
available memory. Due to the design of Microsoft Basic, the maximum memory se,ment
E
"DAS4.
of
the CALL routine described in the
to
make use of the CALL routine "DASABIN",
you do interfere with another program's use of memory, the CALL routine will not
most
likely your PC
on
SAVE
them
before
in
the "I.B.M. BASIC MANUAL".
BI
N"
shows,
it
over any part of memory that is being used by another program e.g.
will
again).
you
direct
do
strange things for a second or two and then hang up
Here
is
run
them!
UO
using BASIC
are
using
some
advice,
Note that the information given
GW
will
have to turn off power and wait a few
when
USR
INP
and
this
section avoids these problems,
it
must first
BASIC) print spoolers or
you
write programs with
routine and supplements the limited
OUT
can
be
loaded into memory.
in
be
somewhat
be
handled
also
permits
"RAM-
CALLS
this section is
(No
in
3-6
DAS-4
MANUAL
PROGRAMMING
that BASIC
following message on power up
BASIC
The exact number of "Bytes free" varies with the version of BASIC(A) and DOS but is usually greater available. When the number of memory bytes free your PC's memory is already
than
its possible routine by further forced contraction of the BASIC workspace and loading the routine at the end
of
the newly defined workspace. DAS4.BIN will occupy about 1852 bytes but to keep things
simple, let's clear a Step 1 is
DOS:-
Note the number return
is
able to use is
The Version D1.10 Copyright 61807 Bytes free
than
60000
bytes
64K
maximum workspace.
2K
to
work
out
how much memory BASIC is able
A>
BASIC(A)
of
bytes free
to
DOS and this time load BASIC(A) with the optional
A> BASIC(A)
64K
bytes.
or
from DOS by entering A> BASIC(A)
IBM
Personal Computer Basic
if
an
excess of memory over and above what BASIC can use is
fully
utilized and BASIC
(2048 byte) space for
in
BASIC's greeting messages. Next
/M:
WS
If
where
BASIC
IBM
If
this
it
WS
is
is
using
Corp. 1981,1982
is
less than
is
is the case, you
a number (not a variable)
its
maximum
60000,
adjusting to
will
to
use. First just load BASIC(A) from
do
/M
parameter:-
64K
you
will
:-
this is an indication that
this
condition by using less
have to load the CALL
a SYSTEM command to
get the
Try
setting the WS (workspace) parameter
free in the greeting message. The objective is to determine the workspace that must
to
reduce the bytes free by at least 2048 bytes. Once BASIC(A) by specifying this workspace or include a CLEAR command right at the beginning of your program e.g.:-
xxxl0 CLEAR,
Next, we need Microsoft derived BASIC, this can be found &W11 and &=lo which hold the current BASIC segment which we can call SG. determined as follows:-
The segment address at which we can now load the working space i.e.:-
to
know what segment BASIC is occupying in memory.
xxx20 DEF SEG
xxx30
xxx40
SG
SG = WS/16 + SG
WS
=
0
=
256*PEEK(&H511) + PEEK(&KS10)
to
30000 or 4oooO and then note the number of bytes
be
specified
this
is determined
from
the contents
'define current segment
before reading absolute addresses 0000:0510
the
CALL routine will simply
'remember segment addresses
on
are
16 bit boundaries
of
absolute memory locations
=
&
0000:0511
0000
you
can either load
In
all
versions of
SG
be
at
can
the
be
end of
The routine can now
xxx50 xxx60 BLOAD "DAS4.BINtt,0
be
loaded as follows:-
DEF
SEG
=
SG
'loads routine at
SG:0000
3-7
PROGRAMMING
DAS-4
MANUAL
A BLOAD
CALL
the
parameters
Note that the starting address of the preceding to associate with the device and would distinguish it might be
(FORTRAN, PASCAL
the name of the external routine that the linker will compilation.
3.19). Returning
defined by the last routine is located. somewhere in a program before entering the
your
program,
DEF
duplication. This precaution can save a computer!
must
be
used as we are loading a binary (machine language) program. Once loaded,
can
be
entered
MD%,
D%, FLAG%
xxx70
xxx80
xxx90
in
interpreted
DEF SEG
in
the same program.
statement. We have chosen
DAS4.0BJ
to interpreted
DEF
Be
as
many times
prior
to
the
as
CALL
DEF SEG = SG DAS4 CALL DAS4
Microsoft
=
0
@ID%,
D%(O), FLAG%)
BASIC, DAS4
CALL
etc.) the significance of
is supplied on the software disk for this purpose (see Sections 3.18
BASIC, DAS4
SEG
careful that
routine from the current segment
In
compiled
statement that tells your
you
BASIC,
is the offset (actually zero)
do not inadvertently redefine the current segment
CALL.
it
is good practice to immediately precede the
SEG
statement (the same one you preceded your
lot
of wasted time and frustration from crashing your
needed
DAS4
in
sequence as follows:-
is a variable that specifies the memory offset
as
from
Quick Basic or other compiled languages
DAS4
in the
If
you
the program after initializing the call
of
as
defined
a
name,
any other
be
BASIC
are
BLOAD
as
it
makes
CALLS
CALL
CALL
is different.
looking for when linking after
from
interpreter where the
using
DEF SEG
statement
with) even at
in
the most recent
CALL DAS4
to other routines that
In
this case,
the current segment as
easy
it
is
&
CALL
in
other parts
by
the appropriate
the
cost
of of
Another important detail to understand is that
BASIC
available
end up loading hang up the computer.
and later load compensating reduction in the workspace memory is limited, setting up a workspace that is a considerable amount less than what is
available
than the
completely into
DOS
loads
contraction
memory
happen on a machine
the workspace
little on
doing.
loading and using the
use
The
have plenty
routine outside the
beginning.
working area up whereas we must
memory down.
our
BASIC
is
a simple precaution. Another precaution in this regard occurs
IBM
P.C.)
that do not contain most of
RAM
and the
from
To
as
a "front end" to your own programs.
second method
BASIC
the top of memory down. The
of
the
minus
the
that used
is
the only way
complex side, but like
further assist you,
of
memory (generally
BASIC
For
example we might choose
If
we attempt
routine over the end
Be
careful this does not happen inadvertently
with
DEBUG
in
the
form
of a
program space load from the bottom of memory up
BASIC
with
of
program space will automatically take place as
by
DOS
and
less than
of
loading the
run
and list the file
CALL
loading the driver
routine and ready made loading and ininalizing code that
256K
workspace.
or some other memory resident program without making a
BASICA.COM
128K
all
In
CLEAR
set
aside space for
to
CLEAR
of the
BASIC
(WS)
the
free
BASICA.EXE
of memory
CALL
things they
is
somewhat simpler
or more) and you have the
this case choose a segment that has
&H6000
sets working space from the bottom
our
subroutine from the top
more space than
program, data space and stack and will
declaration in
BASIC
memory ends up
in
ROM.
and a
BASICA.EXE
becomes less
in
which case further forced contraction
routine. These considerations all sound a
are
not once you understand what you are
EXOO.BAS.
which
is
at 384K. Then proceed as follows:-
is
actually available, we will
if
you
are
memory limited
the
CLEAR
These machines load
in
than
This gives you an examples
to
follow and applies when you
luxury
statement. When
on
computers (other
file.
BASICA.COM,
and
BASICA.EXE
the
middle and some
soon
as the total
MK.
This
can
of loading the
2K
bytes clear at its
of
the
of
BASIC
easily
of
of
you
can
CALL
3-8
xxxl0
DEF
SEG
=
SrH6000
'Sets
up
load segment
DAS-4
MANUAL
PROGRAMMING
xxx20
-30 DAS4
-40
xxxxx
xxxyy xxxzz
An
example of
workspace,
DEF
locations. Usually obliteration of some of the routine code and a computer hangs up, and
floor
large amounts of memory may memory than the example above. resident space in memory
SEG statements in
again. Note that memory resident programs such
in
UP.
be
memory for additional programs such as
BLOAD "DAS4.BIN",O
=
0
DIM D%(3)
I111
Ill1
llll
DEF SEG CALL DAS4
etc.
this
approach is contained
sure you really do have an unused
any
=
&H6000
(MD%,
EXO.BAS
clash with another program's use of the same memory
and experiment
'Loads at
D%(O),
in
file
failure
the
only cure
run
than
earlier versions and
is
to
switch
out of space or require loading the
Also
higher revisions of
6000:oooO
FLAG%)
EXO.BAS.
2K
of
with
Before
memory at
loading the
you
try
384K.
CALL
loading outside the
You
can change the
routine at other
results
to exit and return from the routine. The
off,
wait a few seconds
as
Borland's Sidekick will raise the loading
BASIC(A).
may
require
DOS
In
this case even machines with
with
loading the
and
turn
on the power
DASABIN
additional features use more
CALL
even higher in
routine higher
in
3.3
If
the the subroutine is located. The
As
memory as defined defme the current segment to correspond with the starting address of the this offset is always zero and
The
the addresses
The
BASIC's
must be met:-
1.
FORMAT
you
are
new to using
CALL
CALL,
explained
three
CALL
transfers execution to the machine language (binary) driver routine. Prior to entering
variables within brackets are known
routine unloads these pointers from the stack and uses them to locate the variables
data space
The
CALL
knows
from
OF
THE CALL STATEMENT
CALL
the
DEF SEG
xxxxx
the order
CALL DAS4 (MD%, D%(O), FLAG%)
in
the previous section,
ir!
the last
of
the Variables (pointers) are passed in the sequence written
so
data can be exchanged with them. Three important format requirements
parameters are referenced by position. The subroutine
nothing of the names of
of
statements, this explanation
=
SG
statement sets
CALL
statement for the
DAS4
DEF
SEG
statement.
DAS4
their pointers
=
0.
the
variables, just their locations
on
the stack.
may
assist you in understanding how
the
segment address at which the
DAS4.BIN
is the address offset from the current segment
In
as
the
CALL
driver must
all
of
our
parameters. On executing
examples, we have chosen to
be
of
CALL
to
CALL
the form:-
of
routine, therefore
the
CALL,
BASIC's
stack.
in
If
you
xxxxx
write:-
CALL DAS4
(D%(O),
MD%,
FLAG%)
3-9
Loading...
+ 43 hidden pages