
5.13 _9112_AD_Aquire
uDescription
This function is used to poll the AD conversion data. It will trigger the AD conversion, and read the
uSyntax
Visual C++
int W_9112_AD_Aquire (int card_number, int *ad_data)
Visual Basic
W_9112_ AD_Aquire (ByVal card_number As Long, ad_data As Long )As Integer
C/C++ ( DOS)
int _9112_AD_Aquire (int card_number, int *ad_data )
uArgument
card_number | : | the card number of | |||
ad_data | : |
| |||
within 0 to | 4095. | ||||
Bit | 0 | ~ | Bit | 3 | : is the converted channel number |
Bit | 4 | ~ | Bit | 15 : is the converted A/D data. |
uReturn Code :
ERR_NoError, ERR_BoardNoInit
ERR_AD_AquireTimeOut
uExample
#include “9112.h” main()
{
int ad_data;
int errCode;
Int baseAddr, irqNo;
_9112_Initial( CARD_1, &baseAddr, &irqNo);
/* Assume NoError when Initialize
/* Set to software trigger at first*/ _9112_AD_Set_Mode(CARD_1, AD_MODE_0 ); /* then trigger the AD */ _9112_AD_Soft_Trig(CARD_1);
/* wait for AD data ready then read it */ errCode = _9112_AD_Aquire(CARD_1, &ad_data);
if( errCode == ERR_NoError )
printf( "The AD value is %d.\n", ad_data ); else
printf( "AD conversion error happen\n" );
}Also See Demo Program 'AD_DEMO1.C'