Chapter 4: Programming the AD12-8
Manual Number: 00650-014-4
Page 4-7
Using the Driver with Turbo or Borland C
The following list shows you how to use the driver with Borland or Turbo C. You may refer to any
of the C example programs for further illustration.
A. Include the
A12DRVC.H
header in your program. This simple header provides a function
prototype of the procedure call.
#include a12drvc.h
B. Declare the three variables for the driver globally, at the beginning of your program.
int task,params[5],status;
C. Make your assignment to these variables as desired for the function you wish to perform. See
CHAPTER 5: DRIVER REFERENCE
for details on each task.
D. Make the call to the driver, passing the offset of each parameter.
a12drv(FP_OFF(&task),FP_OFF(params),FP_OFF(status));
E. Create a project file within the Turbo C environment, and add the name of your program with
the .C extension, and the name of the driver with a .OBJ extension.
F. Select LARGE memory model under the compiler section of the options menu.
G. Compile and link the program.
Using the Driver with Microsoft C
To use the driver with Microsoft C version 6.0, add the following code to your application code as
shown below:
_asm
{
push DS
mov AX,ES
mov DS,AX
}
/* call driver as normal */
a12drv(FP_OFF(&task),FP_OFF(params),FP_OFF(status));
_asm
{
pop DS
}