# ACCES I/O Products, Inc.

## AD12-8 DLL Driver Documentation

## Overview

There are five functions exported by this DLL: AD128_Setup(), AD128_Go(), AD128_Status(), AD128_Stop(), and AD128_GetData(). Each function is also exported in underscored form(i.e, _AD128_Setup()); these are equivalent.

## AD128_Setup()

`

function AD128_Setup(ulBase: LongWord; ubIRQ: Byte; iReservedA: SmallInt; iReservedB: SmallInt; lpChannelTable: Pointer; ulCTSize: LongWord; lpGainTable: Pointer; ulGTSize: LongWord; var lpdfRate: Double; lNumPoints: LongInt): LongInt; cdecl;

long AD128_Setup(DWORD ulBase, byte ubIRQ, int iReservedA, int iReservedB, void *lpChannelTable, DWORD ulCTSize, void *lpGainTable, DWORD ulGTSize, double *lpdfRate, long lNumPoints)

`

### Description

AD128_Setup() should be called first for each point set to acquire.

### Parameters

- ulBase: The card's base address.
- ubIRQ: The card's IRQ.
- iReservedA: Reserved. Set this parameter to zero.
- iReservedB: Reserved. Set this parameter to zero.
- lpChannelTable: A pointer to the first byte of the array to take channel indices from. Each channel index is a 16-bit signed integer equal to a value from -1 to 127. Values 0-15 indicate AIM-16 channels 0-15 on AD12-8 channel 0, values 16-31 indicate AIM-16 channels 0-15 on AD12-8 channel 1, etc. If no AIM-16 is used on a particular AD12-8 channel, the AIM-16 channel doesn't matter. The value -1 indicates the end of the table.
- ulCTSize: The length, in bytes, of the channel array.
- lpGainTable: A pointer to the first byte of the array to take gain values from. Each gain value is an 8-bit integer with bits 0 and 1 corresponding to GAIN0 and GAIN1 in the ADC command register(i.e, the gain amplifier is set to 10^(gain table value)). bits 2-8 are reserved; set them to zero. The gain table is indexed by channel, using the values in the channel table.
- ulGTSize: The length, in bytes, of the gain array.
- lpdfRate: A double containing the rate at which to acquire data, in Hz. In C, a pointer to such a double. AD128_Setup() will change this double to be the actual rate data will be acquired at(which will be as close to the value passed to it as possible).
- lNumPoints: the number of points in the point set.

### Return Values

If the function succeeds, it returns zero.

If it fails, it returns nonzero. To get extended error information, call GetLastError().

AD128_Setup() also provides data via the lpdfRate parameter.

## AD128_Go()

`

function AD128_Go: LongInt; cdecl;

long AD128_Go()

`

### Description

AD128_Go() initiates the acquisition of a point set.

### Parameters

This function receives no parameters.

### Return Values

If the function succeeds, it returns zero.

If it fails, it returns nonzero. To get extended error information, call GetLastError().

## AD128_Status()

`

function AD128_Status: LongInt; cdecl;

long AD128_Status()

`

### Description

AD128_Status() can be called to get the number of points yet to be acquired in the point set.

### Parameters

This function receives no parameters.

### Return Values

If the function succeeds, it returns the number of points remaining. This value will be zero or greater.

If it fails, it returns a negative value. To get extended error information, call GetLastError().

## AD128_Stop()

`

function AD128_Stop: LongInt; cdecl;

long AD128_Stop()

`

### Description

AD128_Stop() ceases point list acquisition.

### Parameters

This function receives no parameters.

### Return Values

If the function succeeds, it returns zero.

If it fails, it returns nonzero. To get extended error information, call GetLastError().

## AD128_GetData()

`

function AD128_GetData(lpBuf: Pointer; ulBufSize: DWORD): LongInt; cdecl;

long AD128_GetData(void *lpBuf, DWORD ulBufSize)

`

### Description

AD128_GetData() retrieves the point list acquired.

### Parameters

- lpBuf: A pointer to the first byte of the memory area to place the data into.
- ulBufSize: The length, in bytes, of the memory area to place the data into.

### Return Values

If the function succeeds, it returns the number of bytes actually placed in memory.

If it fails, it returns a negative value. To get extended error information, call GetLastError().