User`s guide
26 • C/C++ Library for DOS
5.7 _8113_AD_Acquire
Description:
This function is used to poll the AD conversion data from a specified channel.
It will trigger the AD conversion, and read the 12 bits A/D data until the data
is ready ('data ready' bit is become to low).
It is a special A/D conversion function, if you do not want to get converted
data from the selected channels list.
Syntax:
int _8113_AD_Aquire( int channel, int *ad_data )
Argument
channel : converted channel no.
ad_data: 12 bits A/D converted value, the value should
within 0 to 4095.
Return Code
NoError
Board_No_Init
AD_Aquire_Time_Out
Example
#include "8113.h"
main()
{
int ad_data;
int ErrCode;
_8113_Initial( CARD_1, 0x220 );
/* Assume NoError when Initialize ACL-8113A */
_8113_ActCard_Set( CARD_1);
/* converter channel 3 to digital data */
ErrCode = _8113_AD_Aquire( 3, &ad_data );
if( ErrCode == NoError )
printf( "The AD value is %d.\n", ad_data );
else
printf( "AD conversion error happen\n" );
}