Manual Number: 00650-014-4
Page 6-2
AD12-8 Manual
Declare Function AD128_Init Lib “c:\ad128s\vbwin\a12drv.dll” (ByVal config As
Integer, ByVal BaseAddr As Integer, ByVal range As Integer, card As Integer) As
Integer
The above function prototype is written on multiple lines in this manual but, in Visual BASIC, the
entire function prototype must appear on a single line. A file is included in the
VBWIN
directory
that declares all functions and provides useful constants. Add the file
A12DRV.GBL
to your
Visual BASIC project file. See your Visual BASIC manuals for information on project files.
You should place a copy of the
A12DRV.DLL
file in your working directory. In Visual BASIC, the
function prototypes contain a path name so that Windows will know where to find the DLL. The
A12DRV.GBL
file function prototypes are configured for the default installation directory struc-
ture. If you change the defaults, then you must edit the
A12DRV.GBL
file to reflect the location of
the DLL.
Initialize the driver.
Now that the application knows about the driver, you must initialize the
driver for operation. This is done with a call to the
AD128_Init
function. The driver may not work
properly if you make any other driver calls before the
AD128_Init
call.
Setup the configuration for all points in your system.
Each point in the system must be config-
ured using the
AD128_SetPointConfig
call. This call allows you to set various options for con-
versions, such as scaling, curves and gains. If you need to set up a sequential series of points with
the same configuration, a single call will suffice, using the start and stop parameter to define the
range of points. The driver will return an error if you attempt to convert a point before setting it up
with a call to
AD128_SetPointConfig
.
Install the desired points into the point list.
There is a single point list in the system. The point
list will still allow you to install points in any order you desire.
Use of the point list is optional. Conversions may be made by direct access to any point in the
system. Also, if the point list is used, direct access to a given point is still available. Points are
added the point list by calls to
AD128_AddPoints
. This routine will append the range of points
indicated to the end of the existing point list, or if the point list is empty, create a point list.
Perform conversions
. Several routines are provided to perform A/D conversions.
AD128_GetDirectPoint
is used for direct conversions, without the point list, to convert a single
designated point address.
AD128_GetIndexPoint
performs a single conversion on a given point
index. The point index indicates which point in the list to convert.
AD128_GetNextPoint
per-
forms a single conversion on the next point in the point list, then increments the point list index.
The next call to
AD128_GetNextPoint
will then convert the next point.
AD128_PollScan
converts a series of points from the point list and stores the conversions in an
internal buffer. A subsequent call to
AD128_PostProcess
will process the data for curve and
scaling functions and then transfer them to a buffer provided by your program. Post processing is
used to increase the system throughput.
AD128_IRQScan
is similar to
AD128_PollScan
except that interrupts are generated by the AD12-
8 at the end of each conversion, rather than using a polling methodology to determine the end-of-
conversion.
Use of other functions.
Other functions can be called to control the digital bits and counters in the
same manner as calls to the A/D routines.