All products manufactured by MetraByte are warranted against defective materials
and workmanship for a period of One Year from the date of delivery to the original
purchaser. Any product found to be defective within the warranty period will, at the
option of MetraByte, be repaired or replaced. This warranty does not apply to
products which have been damaged by improper use.
MetraByte Corporation 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 of other extremely critical systems.
comprehensive set of A/D and D/A driver Functions /
Subroutines used to extend the Fortran compiler. The DASH-
16 FortranLibrary also contains a set of general purpose
I/O functions (INP, OUT,
PEEK & POKE) to Write and read
bytes or words to or from a user defined I/O port or memory
location over the entire 8088/86 address range of 0 to (2-16
- 1).
I/O devices e.g.
This allows the user to directly drive other MetraByte
the PIO-12 Parallel I/O board directly for
a variety of control applications and also allows memory
mapped devices to be used with Fortran. The DASH - 16
Library follows the linking
format as required by the
Microsoft Fortran Compiler Version 3.2, and is outlined in
the following sections.
SOFTWARE INSTALLATION AND BACKUP
The installation of the DASH-16 interface board is outlined
in the DASH-16 manual chapter 2. The selection of the BASE
address and Interrupt and DMA levels are internally set as
noted in chapter 1.
programmable).
DEVELOPMENT AND THE MASTER DISK STORED IN
A BACKUP COPY SHOULD BE USED FOR PROGRAU
(Base Address = Hex 300, DMA = 1, INT =
A
SAFE PLACE.
The
disk format is Single Side Double Density DOS 1.10 format
and is read compatible for all versions of PC-DOS. Chapter 5
of the DASH-16 manual shows the hookup of the counter/timers
for external trigger of the A/D.
The DAS16FOR.LIB will support DOS 1.10 through DOS 3.00
Fortran compiler versions from 3.0 to 3.2.
Programmers should use
and MS
the MS LINK.EXE which is supplied with your Fortran Compiler to
obtain upward compatibility.
Do not
use the LINK.EXE supplied
with DOS as several revisions and adjustments have been made in
the linker program.
1.11
The DASH-16 Fortran library is used at the linker level as
most libraries.
compiled according to the Fortran users guide the linker is
ready to produce an run-time EXE file. The Linker will
automatically search the Fortran
the standard functions.
the user will respond with DAS16FOR.LIB to the question of
LIBRARY: when asked. The session would be as follows.
A>LINK
Microsoft linker version XX . . . . . .
Object modules [.OBJ] filespec
Run File [ FILESPEC.EXE 1: <return>
List Map [NUL.MAP]: <return>
Libraries [.LIB]: DAS16FOR
The DAS16FOR.LIB library should be the last library linked during
the link session.
are labeled DATA and not
still link without error< since the DGROUP combines all data
segments labeled DGROUP under one segment. See linker manual.
USING THE LIBRARY
Once the users Fortran program has been
libraries required to link
In order to link the DASH-16 library
The data segments used in the DAS16FOR library
DATA as in MS Fortran 3.30. This Will
At this point all will be automatic.
as needed by the Fortran program. When the prompt displays the
program may be run by typing the name. The following sections
will explain the library functions and the,Fortran format.
A>FILESPEC
This will execute the
.EXE file and run the program
The library will be loaded
2
2.0
DASH-16 FORTRAN SUBROUTINE LIBRARY DESCRIPTIONS
All the following DASH-16 subroutines follow the Standard
Fortran functions/subroutines and may be nested up to the
limits of the compiler.
part of
the Fortran
function/subroutine names become
be used as labels.
The variable names used for the DASH-16
library functions are considered
variables and must be adhered to or else strange
will occur.
Using these function names as labels will
introduce bizarre run and linking errors.
consists of two types of functions,
Since the following library becomes
library
RESERVED
INTEGER*2
the
following
names and may not
type for all
errors
The library
the unique DASH - 16
functions and the general purpose I/O type functions. The
following is
incorporated in the library.
a
list of the functions/subroutines
The page numbers have been
added to this section also for the convenience of the user.
FORTRAN LIBRARY DESCRIPTION OF LIBRARY SUBROQTINES
ADINIT ( BASADR, DMALEV, INTLBV, RTNFLG )
This function initializes
parameters in order for the
the DASH-16 identification
library functions to
be
used.
The function does not have to be executed within a Fortran
module since the library has default values.
If other than
the default values are used then this function must be
executed.
The ADINIT function also allows the user to setup
a second board for communications with the system, however
only one board is allowed to be operational at a time. If
the user wishes to run more than one board in the system,
this command should be run for all the boards in the system
first. The parameter limits are as follows.
names are
BASADR
INTEGER*2
type (2 Bytes length).
= Base Address of DASH - 16 board (OlOOH to 03FOH)
This address range is
checked before further
All variable
execution.
DHALEV
= DMA Channel number of DASH - 16 board ( 1 or 3 )
0000H = function successful. continue normally.
000lH
0003H
0004H
0005H
= System already in use. can't continue.
= BASADR variable range error, <lOOH,>3FOH
= INTLEV variable range error, <2 or >7.
= DMALEV variable range error, not 1 or 3
#o)
GOTO 10
4
DASH-16 FORTRAN LIBRARY
ADCONV 1 MODE, SCH, FCH, NOS, DATIN(n), RTNFLG )
This function allows the user to collect data via the A/D
converter using one of five modes. The user also selects the
number of channels Start to Final, and the Number Of Scans
for data collection.
to the Final Channel (SCH to FCH). If the Start Channel
(SCH) = 0, and the Final Channel (FCH) = 7, then one scan
would collect 8 channels of data into the array DATIN(n).
The array size must be large enough to receive the data, at
least ( NOS*(FCH-SCH +l) 1. If SCH = FCH then the Number Of
Scans (NOS) will be the actual number of conversions for
that channel.
If 100 conversions are required on channel 3
then, SCH = FCH = 3, and NOS = 100, The array must be at
least DATIN(100)
statement.
typing
In MODES 1, 2,
ESC
key
next Fortran statement after the ADCONV statement. This will
allow termination of data collection with out re- booting
the system. All data previously collected before
was pressed
will be valid and the return flag code will be
HEX 1000. (#lOOO).
DESCRIPTION OF LIBRARY SUBROUTINES
A Scan is defined as the Start Channel
[ INTEGER*2 type ] in a DIMENSION
3 and 4 (external trigger modes)
will terminate the run and execute the
Esc key
MODE =
Data
0 =
1=
2 =
3 =
Collection Mode A/D only
Internal start of conversion (start on entry)
Immediate start of conversion by software and
collect the specified number of conversions
to the specified array.
This routine is
program control only (NO DMA).
External trigger for each conversion.
Transfer data to the specified array under
program control. The A/D starts with the
external trigger for each conversion. The
number of conversions is determined by the
NOS and the number of channels. This mode is
also program control data transfer (NO DMA).
External trigger for each block (SCH-FCH) of
channels (NO DMA) under program control. An
error code will be returned if the limits are
exceeded.
External trigger for each conversion (DMA).
This routine collects the data after each
external trigger and transfers the data to
the array via DMA. The user
remains in this
routine until all the specified conversions
are completed.
The user may interrupt the
5
DASH-16 FORTRAN LIBRARY DESCRIPTION OF LIBRARY SUBROUTINES
data collection by pressing the
Esc key.
4 = External trigger for each block (SCH-FCH) of
channels using DMA.
An error code will be
returned if the limits are exceeded. Although
DMA transfer,
this mode can only be driven at
interrupt rates.
5 = External Trigger Background DMA Data
Transfer.
This mode allows the user to
collect data in the background while running
a secondary program in the foreground.
Background
data
collection
runs at the
The
maximum transfer rate of the A/D converter or
the rate of the external trigger. 'It is the
users responsibility to insure the variable
data
array is not
collection.
changed during
The user may check the status of
data
the data transfer at any time by the DMASTA
function which returns the current number of
conversions and the current DASH-16 board
status.
The user may terminate the data
collection before the normal end of transfer
by the DMAOFF function.
6 = External Trigger DMA mode Auto-Initialize.
This mode allows the user to collect data
into the specified
background.
The data is collected until a
array
continuously in the
DMAOFF function is executed. It is the users
responsibility to disable the DMA operation
when data collection is no longer required.
NOTE:
The output of counter 2 may be internally
connected to the A/D trigger input (IPO) by
adding 16 decimal (#lo hex) to the mode.
EXAMPLE:
MODE = 4t16 Will be mode 4 and
counter 2 output will be the Trigger for
the A/D converter.
Diff.) This channel is automatically reloaded when
the FCH (final channel) is reached in the
register.
An error code will be returned if the
MUX
scan
limits are exceeded.
PCH =
Final Channel ( 0 - 15 Single Ended ) ( 0 - 7
Diff.).
when the SCH (start channel) reloads the
This channel is automatically reloaded
MUX
scan
6
DASH-16 FORTRAN LIBRARY
register. An error code will be returned if the
limits are exceeded.
DESCRIPTION OF LIBRARY SUBROUTINES
NOS =
RTNFLG
= Flag Return code for status of function selected.
HEX CODE 0
DATIN(n) =
Number Of Scans for each group of channels
specified by SCH and
FCH. NOC (number of
conversions) is defined by the equation, NOC = NOS
* ( FCH - SCH + 1 ).
The number of conversions
must be with in the range of NOC max = 32760, NOC
min = 1. An error code will be returned if the
limits are exceeded.
=
Transfer ok
=
1
SCH, FCH
channel limits exceeded for
Differential
=
2
SCH, FCH channel limits exceeded for Single
Ended
3
4
5
6
100
1000
NOC Limit error
A/D DMA mode or Board Busy
Time out. No EOC from convertor
DMA Vector level range error
DMA / Data collection hardware error
Function Terminated by Esc key sequence
Data Transfer variable
< 1 or > 32760
INTEGER*2
type Only. !!I
This variable is used for data transfer and may be
a single variable if only a single channel is to
be converted.
length less than or equal to 32760
conversion.
lb bits and a
DATIN(~) may be an array of max
for the data
This is due to the fact of segments Of
lb
byte boundary constraint. The
variable must be a word (2 bytes) type integer.
The size n = NOS*(FCH-SCH+l) minimum.
EXAMPLE:
C
**** INITIALIZE VARIABLE'S TYPE FOR USE WITH FUNCTION ****
INTEGER*2 MODE, SCH, FCH, NOS, RTNFLG DATIN
C
C
**** DIMENSION DATA ARRAY FOR (FCH7-SCHO+l)*lOO = 800
C
DIMENSION DATIN (800)
C
C
***** INITIALIZE VARIABLES ******
C
MODE0 = 0
SCHO = 0
FCH7 = 7
NOSlOO = 100
7
DASH-16 FORTRAN LIBRARY
RTNFLG = 0
C
C
C
C
C
******* COLLECT DATA FROM A/D INTO ARRAY *******
- THE DATA WILL BE COLLECTED UNDER PROGRAM CONTROL -
CALL ADCONV (
MODEO,
IF (RTNFLG .NE. 0) GOT0 400
C
C
C
C
C
C
400
401
. . . . . . USER CONTINUES PROGRAM HERE . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
****** ERROR HANDLER IF RTNFLG NOT ZERO ******
WRITE (*,401) RTNFLG
FORMAT (1X,
'ERROR DURING A/D CONVERSION FUNCTION IS ', 12)
END
DESCRIPTION OF LIBRARY SUBROUTINES
SCHO, FCH7, NOSlOO, DATIN(l), RTNFLG )
This function allows the user to condition the A/D data
collected
supplied by the variable DATAX and the function returns two
values.
collected on and returns it to CHANX variable.
value is returned as a function value in the form FIXDATA =
DlbFIX ( DATAX, CHANX ), where FIXDATA stores the 12 bit A/D
integer data in the range 00 to 4095 for unipolar and 00 +/-
2048 for bipolar settings of the DASH-16.
EXAMPLE:
C
***** ASSUME ARRAY OF DATA DATIO(1000) WAS COLLECTED ****
C
INTEGER*2 DATIO,DATX,CHANX, J
C
C
**** DECLARE THE FUNCTION AS AN INTEGER FUNCTION ***
C
n
L
INTEGER*2 DlbFIX
DIMENSION CHANX(~OOO),DATX(~OOO),DATIO(~OOO)
C
C
MAKE NEW ARRAY OF FIXED DATA AND ASSOCIATED CHANNEL #
C
DO 100 J=l,lOOO
DATX(J) = D16FIX (DATIO(J), CHANX(J)J
100 CONTINUE
C
STOP
END
D16FIX
( DATAX, CHANX )
from
ADCONV in mode 5 or 6.
The A/D data is
The first value is the CHANNEL the data was
The second
DASH-16 FORTRAN LIBRARY
DESCRIPTION OF LIBRARY SUBROUTINES
DMASTA
( RTNSTATUS )
This routine allows the user to monitor the status of the
DASH-16 while it is collecting data in mode 5 or 6. The
routine may be either a subroutine for just the current
status or a function for the status and the current number
of conversions.
If the function is executed and mode 5 is
inactive the returned value will be 0 else the returned
value will be the current number of conversions. The status
is returned in either case.
If the word count = 0 and the
DMASTA function is executed then a -32767 or some other
negative value will return.
StatUS
corresponds to the DASH-lb CONTROL register and
The bit assignments for the
STATUS register found in sections 3.5 and 3.6 of the DASH-lb
manual.
INTEGER BIT ASSIGNMENT
--- --- ---
15 14 13
--- --- --DASH - lb
SECTION 3
--- I_-- I---
CONTROL REGISTER DASH - lb STATUS REGISTER
6 DASH-lb MANUAL
--- I--- I--- I--- I---
i
SECTION 3.5
___1___1_-_1___l___l---l---~---
DASH-16 MANUAL
EXAMPLE:
C
C
***** SETUP AD MODE 5 AND ARRAYS ******
INTEGER*2 DATIN, NOC, DASlbSTAT, RTNFLG, DMASTA
C
DIMENSION DATIN (1024)
C
C
C
C
--- SETUP COUNTER 0 FOR 1 KHz TICKS ---
-- CONNECT CNTR 0 OUT TO TRIG IN, OP0 TO CNT0 GATE IN. -CALL CNTMO (2,1000)
--- READ STATUS AND PRINT THE CONVERSION NUMBERS --NOC = DMASTA ( DAS16STAT )
IF ( NOC .GT. 0 .AND. NOC .LE. NOSl00 ) GOT0 200
GOT0 500
C
200
WRITE (*,201) NOC
9
DASH-16 FORTRAN LIBRARY
DESCRIPTION OF LIBRARY SUBROUTINES
201 FORMAT (IX,
'THE CURRENT CONVERSION IS ',I51
GOT0 100
c
400 . . . . ERROR HANDLER ROUTINE PRINT ERROR
500 END
DMAOFF
This routine allows the user to terminate the DMA data
collection in mode 5 or 6 of the ADCONV function. This
function does not have any variables associated with it and
may be used any
time
the user wishes to reset the
dmafinterrupt hardware to a known inactive state. This
routine
MUST
be executed before termination of program if
modes 5 or 6 are used.
EXAMPLE:
****** INITIATE A TERMINATE DMA ******
CALL DMAOFF
END
. . . . . .
10
DASH-16 FORTRAN LIBRARY DESCRIPTION OF LIBRARY SUBROUTINES
DAOUT ( DACN, DATOUT(n), RTNFLG )
This function allows the user to transfer data to a selected
D/A converter channel or both D/A channels with one command.
The D/A converters are 12 bit allowing the range of 0 to
4095 decimal.
INTEGER*2
type.
The DAOUT functions variables
The function DATOUT(n) may be any INTEGER
variable name or array.
If both D/A'S are selected then the
are all
DATOUT(n) is expected to be an array of two. The return
flag,
RTNFLG,
will return a value of 0 if all O.K. or a
value of 1 if the DAC's have been called by another user
task.
DACN =
RTNFLG =
DATOUT(n) =
EXAMPLE:
C
C
c
C ***** TRANSFER TO DAC CHANNEL
C
C
C . . . . . .
D/A Converter Selected for output
0 = D/A converter channel 0
1 = D/A converter channel 1
2 = Both D/A converters 0 a 1
Return flag code for multitask
0 = transfer completed all OK
1 = function previously called by another
task and data transfer is incomplete.
No transfer takes place.
INTEGER*2 (2 byte) Data variable.
If DACn = 0 or 1 then DATOUT(n) may be a
single INTEGER variable or an Array. If DACn
= 2 then the function will expect the data to
be an INTEGER Array and n will point to DAC
channel 0.
***,** SETUP INTEGER VARIABLES
*****
INTEGER*2 DAC, DATOUT, RTNFLG
DAC = 0
DATOUT = #400
RTNFLG = 0
0 *****
CALL DAOUT ( DAC, DATOUT, RTNFLG )
IF (RTNFLG .NE. 0) GOT0 10
USER PROGRAM CONTINUES . . . . . . .
. . . . . . . . . . . . . .
11
DASH-16 FORTRAN LIBRARY DESCRIPTION OF LIBRARY SUBROUTINES
. . . . . . . . . . . . . .
10 . . . . . .
C
C
This function allows the user to transfer a four bit value
(bits 3, 2,
output port on the DASH-16.
4 bits range,
significant four
INTEGER*2
DATOUT
EXAMPLE:
C
C
C
C
C
C
C
C
C
C
C
C
C
C
PROCESS RTNFLG RETURN CODE FOR MULTI-TASK . . . .
--------- IF RTNFLG = 1 THEN
OUTPUT RTNFLG FOR SOMEONE ELSE IS USING THE
DIGOUT ( DATOUT )
_----------
SYSTEM
1, 0 ) in the range of 0 to 15 to the digital
The digital port is limited to
and the function passes only the least
bits
MOD(2^4 - 1). The variable must be of
type.
= data to be transferred. (00 to 15) DECIMAL
****** SETUP DATA TO BE TRANSFERRED ******
INTEGER*2 DATOUT
DATOUT = #03
***** TRANSFER DATA TO DIGITAL PORT *****
CALL DIGOUT ( DATOUT )
**** TRANSFER A CONSTANT VALUE FOR DATA ****
CALL DIGOUT ( 15 )
** TRANSFER A INTEGER USING A FUNCTION AS A VALUE **
CALL DIGOUT ( IABS(7.45) )
-- THE DATA TRANSFERRED IS THE INTEGER VALUE OF 7 --
END
12
DASH-16 FORTRAN LIBRARY
DIGIN ( DATAIN )
DESCRIPTION OF LIBRARY SUBROUTINES
This function allows the user to read the four
available at the digital input port on the DASH-16 board.
The data range is returned INTEGER*2 format in the range of
0 to 15. The INTEGER variable DATAIN receives the data. This
function may also be used directly with conditional
statements.
DATAIN
EXAMPLE:
C
C
C
bits of data
= INTEGER*2 data variable for data transfer.
***** SETUP VARIABLE FOR DATA TRANSFER *****
INTEGER*2 DATAIN, X, DIGIN
DATAIN = 0
****** READ DIGITAL INPUT PORT BITS 0,1,2,3 ******
X = DIGIN ( DATAIN )
****** USE FUNCTION IN CONDITIONAL STATEMENT ******
IF ( DIGIN (DATAIN)
.EQ. 4 ) GOTO 400
. . . . . PROGRAM CONTINUES IF NOT EQUAL TO 4 . . . . .
. DATA IS ALSO PASSED TO VARIABLE DURING EXECUTION
C
C
400
401
WRITE (*,401) DATAIN
FORMAT (1X,
'THE DIGITAL PORT HAS A VALUE OF ,I2 )
C
C
. . . DIGITAL INPUT PORT WAS 4 . . . . .
C *** PASS FUNCTION VALUE TO TWO VARIABLES TOGETHER ***
C
n
X = DIGIN ( DATAIN )
G --- BOTH X AND DATAIN HAVE THE DIGITAL PORT DATA ----
C THE VARIABLE DATAIN MUST BE A NAME FOR DATA TO BE
C
C IS USED.
C
TRANSFERRED IN. UNKNOWN ERRORS WILL OCCUR IF A CONSTANT
END
13
DASH-16 FORTRAN LIBRARY
CNTHIn ( MODE )
This function allows the user to read the selected counter
in one of two modes,Latched or Non-latched. There are three
counters available to the user and the selected counter is
specified by "n", where n is 0, 1, 2. All three counters are
completely independent.
conditional statements as shown in the example.
variable
also of the
must be
INTEGER*2
be tvoe matched. The data ranae returned
in the range of 0 to 65535 (0000 to #FFFF) -16 bits.
***** USE COUNTER 1 WITH CONDITIONAL STATEMENTS *****
IF
= Selects one of two read modes.
0
= UN-Latched read on the fly (dynamic)
>= 1
= Latched,
Data
is latched prior to reading
This mode is active for any value except 0.
****
INl,DATIN2,CNTMIO,CNTMIl,CNTM ,I2
CNTMIO ( MODE )
= CNTHIZ ( MODE )
( CNTMIl (MODE)
.GE. 1000 ) GOT0 400
. . . . . . CONTINUE PROGRAM, COUNTER IS LESS THAN 1000
. . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
400
WRITE (*,401)
CNTUIl(MODE)
401 FORMAT (1X, 'THE CURRENT VALUE OF THE COUNTER IS ',15)
14
DASH-16 FORTRAN LIBRARY
CNTMOn ( MODE, DATOUT )
This function allows the user to load the selected counter
with the value specified by the DATOUT integer value. There
are three counters available to the user, where n = 0, for
counter
1 for counter 1,
0,
counter is independent from the others. The selected counter
may be initialized (loaded) in one of six modes for user
versatility. The counters may be programmed to be a divider,
a programmable event counter,
shot and a programmable real time clock. The counters may be
connected in almost any configuration at the 37 pin edge
card connector, ( refer to the DASH -16 manual for the
various connections).
DESCRIPTION OF LIBRARY SUBROUTINES
and 2 for counter 2.
a programmable digital one
Each
MODE =
Selects
the current
counter. The mode value range is
operating mode for the
0
to 5.
any
attempt to load a value less than 0 will load 0,
and any value larger
0 = Output goes high on terminal count.
than 5 will load 5.
The
output remains high until Re-loaded. The output
will be set low upon execution and
starts counting.
If this mode is entered while the
counter is counting the counter will stop until
the new count value is loaded and then start a new
count with the new values entered.
1
= Programmable one-shot.
Output will go low on
the count following the rising edge of the gate
input. The output will go high on the terminal
count.
If a new value is loaded while the output
is low it will not affect the duration of the one-
shot pulse until the succeeding trigger.
The one-shot is retriggerable,
hence the output
will remain low for the full count after any
rising edge of the gate input.
2 = Rate Generator.
Divide by N counter. The
output will be low for one period of the input
clock.
The period from one output pulse to the
next equals the number of input counts specified
by the DATOUT variable.
Reloading will change the
rate on the next count cycle. The counter will
start counting at execution of this function.
The gate input, when low, will force the output
15
DASH-16 FORTRAN LIBRARY DESCRIPTION OF LIBRARY SUBROUTINES
high.
When the gate input goes high, The counter
will start from the initial count.
3 = Square Wave Rate Generator.
Similar to mode
2 except that the output is a square wave ( 50%
duty cycle ).
The counter will remain in the
square wave state and at the rate programmed until
reloaded.
defined as,
The frequency of the square-wave iS
l,OOO,OOO / DATOUT.
The gate input, when low, will force the output
high.
When the gate input goes high, The counter
will start from the initial count.
4= Software Triggered Strobe.
The output goes
low upon execution of function and starts counting
at the number value of DATOUT. On terminal count,
the output will go low for one input clock period,
then go high again.
If the counter is reloaded
between output pulses the present period is not
affected, but the subsequent period will reflect
the new value.
The count will be inhibited while
the gate input is low.
5 = Hardware Triggered Strobe.
will start counting after the rising edge of the
trigger input and will go low for one clock period
when the terminal count is reached. The counter is
retriggerable. The output will go low until the
full count after the rising edge of any trigger.
DATOUT = Data value to load
expected to be INTEGER*2
variable for all modes is 2 to 65535 (16 bits). Any
attempt to load a number less than 2 will automatically
load the value 2. Any attempt to load a number larger
than 65535 will then load MOD(2^16 - 1).
NOTE:
Counters 1 and 2 of the DASH-16 are Cascaded to make up a 32
bit counter.
The counters 1 and 2 have a 1 MHz input clock
and Counter 0 has a 100 KHz clock input. To use counters 1
and 2 as a rate timer (real time clock) then the output
ticks will be defined by:
FREQUENCY =
where:
CNTMl and CNTM2 are the data values loaded into the counter.
All other modes are available to the user. Counter 0 as a
counter
lo**6 f (CNTM~ * CNTM~)
with. The variable is
type.
The range of the
The counter
16
DASH-16 FORTRAN LIBRARY
DESCRIPTION OF LIBRARY SUBROUTINES
real time
clock is defined by:
FREQUENCY = lo**5 / CNTMO data
For more
information on the counter timers on the DASH-16 refer
**** SETUP COUNTER 0 FOR EXTERNAL HARDWARE TRIGGER ****
C
CALL CNTMOO (ItODES, DATOO)
C
C
**** SETUP COUNTER 1 FOR DIVIDE BY N COUNTER ****
C
CALL CNTMOl ( MODEZ, DATOl )
C
C
**** SETUP COUNTER 2 FOR DIVIDE BY N COUNTER ****
C
CALL CNTMOZ ( HODEZ, DAT02 )
C
C
* Cascade Counter 1 and Counter 2 to generate a 1 KHz wave *
C
C
:
SETUP COUNTER 0 TO USE THE INTERNAL 1OOKHz ON BOARD
REFERENCE.
TO DO THIS OUTPUT A BYTE t02 TO THE COUNTER
CONTROL REGISTER AT BASE ADDRESS + 10
C
CALL OUTB ( (BASADR+10),#02)
C
C
COUNTER 0 IS NOW INTERNALLY REFERENCED TO 100,000 Hz
C
END
17
DASH-16 FORTRAN LIBRARY DESCRIPTION OF LIBRARY SUBROUTINES
INPB ( PORT )
This function allows the user to input data from a specified
I/O port. The data transferred is in BYTE format (0 to 255).
The variable PORT is a
INTEGER*2
type and has the full range
of the 8086/8088 processor of MOD(2-16 - 11, (0 to 65535).
This function may be used with conditional statements as
shown in the examples.
INPB performs the same function as
the IN Byte instruction in assembly language. The data is
transferred
using MOD(2-8 - 1) format.
PORT
EXAMPLE:
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
400
401
= I/O Address in the rance of MOD(2^16 - 1)
[ 0 tog-65535 1.
*** SETUP PORT VARIABLE ***
INTEGER*2 PORT, PRTDAT, INPB
PORT = t3F8
**** READ PORT ****
PRTDAT
= INPB(PORT)
**** READ PORT WITH CONSTANT AS VARIABLE ****
PRTDAT
= INPB (13PS)
**** USE FUNCTION WITH CONDITIONAL STATEMENTS ****
IF
( INPB(
. . . . .
PORT )
.EQ. 1180 ) GOT0 400
CONTINUE NOT EQUAL TO 1180
. . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
---- IF PORT IS #80 EXECUTE THIS PROGRAM ----
WRITE
FORMAT (IX,
(*,401) INPB(PORT)
'THE VALUE AT THE PORT IS ',13)
END
18
DASH-16 FORTRAN LIBRARY
INPW ( PORT )
This function allows the user to input data from a specified
I/O
6553
port.
5) *
The data transferred is in WORD format (0 to
The variable PORT is a
full range of the 8086/8088. processor of MOD(2-16 - l), (0
to 65535).
This function may be used with conditional
statements as shown in the examples. INPW performs the same
function as the IN Word instruction in assembly language.
The data in is Low Byte from PORT and High Byte form PORT+l.
The data is transferred using MOD(2^I6 - 1) format.
DESCRIPTION OP LIBRARY SUBROUTINES
INTEGER*2
type and has the
PORT
EXAMPLE:
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
400
401
= I/O Address in the range of MOD(2^16 - 1)
[ 0 to 65535 1.
*** SETUP PORT VARIABLE ***
INTEGER*2 PORT, PRTDAT, INPW
PORT = #3Fl7
**** READ PORT ****
PRTDAT
= INPW(PORT)
**** READ PORT WITH CONSTANT AS VARIABLE ****
PRTDAT
= INPW (#3P8)
**** USE FUNCTION WITH CONDITIONAL STATEMENTS ****
IF
( INPW( PORT )
. . . . . CONTINUE NOT EQUAL TO #8000
.EQ. t8000 ) GOT0 400
. . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
---- IF PORT IS t8000 EXECUTE THIS PROGRAM ---WRITE
FORMAT (1X,
-._-
(*,401) INPW(PORT)
'THE VALUE AT THE PORT IS ',15)
19
DASH-16 FORTRAN LIBRARY DESCRIPTION OF LIBRARY SUBROUTINES
OUTB ( PORT, DATOUT )
This function allows the user to output data to
I/O port.
The variable PORT is a
of the 8086/8088 processor of MOD(2^16 - 11, (0 to 65535).
This function may be used with conditional statements as
shown in the examples.
the OUT Byte instruction in assembly language. The data is
transferred using MOD(2^8 - 1) format.
PORT =
DATOUT
EXAMPLE:
C
C
C
C
C
C
C
C
a specified
The data transferred is in BYTE format
INTEGER*2
type and has the full range
(0 to 255).
OUTB performs the same function as
I/O Address in the range of MOD(2^16 - 1)
1 0 to 65535 1.
= Byte Data to output. The data is MOD (2-8 - 1).
*** SETUP PORT VARIABLE ***
INTEGER*2 PORT,DATOUT
PORT = t3F8
DATOUT = #F3
**** WRITE DATA TO PORT hex 3F8
CALL OUTB (PORT, DATOUT)
**** WRITE PORT WITH CONSTANT AS VARIABLE ****
**** OUTPUT hex F3 TO PORT hex 3F8 ****
CALL OUTB ( #3FB, #F3 )
END
20
DASH-16 FORTRAN LIBRARY
OUTW ( PORT, DATOUT )
This function allows the user to output data to a specified
I/O port.
65535).
The data transferred is in WORD format (0 to
The variable PORT is a INTEGER*2 type and has the
full range of the 8086/8088 processor of MOD(2^16 - l), (0
to 65535).
This function may be used with conditional
statements as shown in the examples. OUTW performs the same
function as the OUT Word instruction in assembly language.
The output is Low Byte to PORT and High Byte to PORT+l. The
data
iS
transferred using MOD(2^16 - 1) format.
PORT = I/O Address in the range of MOD(2-16 - 1)
[ 0 to 65535 1.
DATOUT = Byte Data to output. The data is MOD (2-16 - 1).
EXAMPLE:
DESCRIPTION OF LIBRARY SUBROUTINES
C
*** SETUP PORT VARIABLE ***
C
INTEGER*2 PORT,DATOUT
PORT = #3F8
DATOUT = #lOF3
C
C
**** WRITE DATA TO PORT hex 3F8
CALL OUTW (PORT, DATOUT)
C
C **** WRITE PORT WITH CONSTANT AS VARIABLE ****
C
This function allows the user to write a byte any where in
memory by defining the SEGMENT and OFFSET. The byte is
written to location MSEG:MOFF.
MOV ES:IOFFSET reg], reg. in 8088 assembly language. The
variables are INTEGER*2 type.