Manual Number: 00650-014-4
Page 4-6
AD12-8 Manual
Programming Using the Drivers
Using direct register access to program the AD12-8 is straightforward but the coding can be rather
tedious. To assist you in building your application quickly, a driver is provided. This driver is
provided in three forms. Which form you use will depend on the programming language that you
intend to use in your application. A task reference for this driver is provided in
CHAPTER 5:
AD12-8 DRIVER REFERENCE
. The driver file names and their language use are as follows:
A12DRV.BIN
A BASIC loadable driver for use with most interpreted BASIC
languages.
A12DRV.OBJ
A Pascal and QuickBASIC linkable driver in object form.
A12DRVC.OBJ
A C linkable driver in object form.
Also, to help you understand how to use the driver with your program, sample programs are pro-
vided in three languages; C, Pascal, and QuickBASIC. Sample 3 is provided in Pascal and C
only. The programs are:
SAMPLE 1 - Demonstrates data acquisition using polling.
SAMPLE 2 - Demonstrates timer-driven data acquisition using interrupts.
SAMPLE 3 - Same as Sample 2 but uses the configuration file to set up the driver.
To access the functions of the driver, a call to a single procedure within the driver is used. The
name of the procedure for the driver is
A12DRV
. The procedure is called with three variables,
which are defined as follows:
task:
The number of the task to perform. A reference with a list of tasks for each
driver are provided in
CHAPTER 5: AD12-8 DRIVER REFERENCE
.
parameters:
This is an array of integers which contains information required by the
driver.
CHAPTER 5: AD12-8 DRIVER REFERENCE
defines what
values need to be passed for each task. The array should hold five integers.
status
:
An error code is returned in this variable. A zero is returned if there is no
error.
When calling the procedure, certain important requirements must be met:
A. The three variables must be declared as global. If they are not, the driver will not be able to find
their data segment. Most programming languages only use the data segment for global variables,
which is permanent storage. Variables declared in procedures are usually allocated on the stack,
which is temporary storage.
B. The driver expects parameters to be integer type variables and will write to and read from the
variables on this assumption. The driver will not function properly if non-integer variables are
used in the call.
C. The variables should be passed by reference. The driver expects offsets of the variables so that
data may be returned when required.
D. The passed variables are positional. That is, the variables must be specified in the sequence
(task, parameters, status). Their location is derived sequentially from the variable pointers on
the stack.
E. The driver will not function properly if arithmetic functions (+, -, x, etc) are specified within
the variable list bracket.