ADLINK ACL-8112 Series User Manual

Page 78

Advertising
background image

70

• C Language Library

7.12 _8112_AD_Aquire

Description

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

Syntax

int _8112_AD_Aquire( int *ad_data )
int _8112pg_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 “8112.h”
main()
{

int ad_data;

int ErrCode;


_8112_Initial( CARD_1, 8112B-DG, 0x220 );

/* Assume NoError when Initialize ACL-8112 */


/* Set to software trigger at first*/
_8112_AD_Set_Mode( AD_MODE_1 );
/* then trigger the AD */

_8112_AD_Soft_Trig();

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

ErrCode = _8112_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_DEMO.C'

Advertising