beautypg.com

ADLINK ACL-8111 User Manual

Page 51

background image

C/C++ Library for DOS 45

5.12 _8111_AD_Aquire

@ Description

This function is used to poll the AD conversion data. It will trigger the AD
conversion, and read the 12-bit A/D data until the data is ready ('data
ready' bit becomes low).

@ Syntax

int _8111_AD_Aquire( int *ad_data )

@ Argument:

ad_data: 12-bit A/D converted value, the value should

within 0 to 4095.

@ Return Code:

ERR_NoError
ERR_BoardNoInit
ERR_AD_AquireTimeOut

@ Example:

#include “aclerr.h”
#include “8111.h”
main()
{

int ad_data;

int ErrCode;

_8111_Initial( CARD_1, 0x220 );

/* Assume NoError when Initialize ACL-8111
*/


/* Set to software trigger at first*/

_8111_AD_Set_Mode( IRQ5, AD_MODE_1 );

/* then trigger the AD */

_8111_AD_Soft_Trig();

/* wait for AD data ready then read it */

ErrCode = _8111_AD_Aquire( &ad_data );


if( ErrCode == ERR_NoError )

printf( "The AD value is %d.\n", ad_data );

else

printf( "AD conversion error happen\n" );
}

Also see deme program 'AD_DEMO1.C'