HP (Hewlett-Packard) 9112 Series Network Card User Manual


 
50
C/C++ Library
5.13 _9112_AD_Aquire
u 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).
u Syntax
Visual C++ (Windows-95)
int W_9112_AD_Aquire (int card_number, int *ad_data)
Visual Basic (Windows-95)
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 )
u Argument
card_number : the card number of PCI-9112
ad_data : 12-bit A/D converted value, the value should be
within 0 to 4095.
Bit 0 ~ Bit 3 : is the converted channel number
Bit 4 ~ Bit 15 : is the converted A/D data.
u Return Code :
ERR_NoError, ERR_BoardNoInit
ERR_AD_AquireTimeOut
u Example
#include “9112.h”
main()
{
int ad_data;
int errCode;
Int baseAddr, irqNo;
_9112_Initial( CARD_1, &baseAddr, &irqNo);
/* Assume NoError when Initialize PCI-9112 */
/* 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'