Visual C++ (MFC)

It is an example program in Visual C++. The conversion data and error contents are displayed in output window.
Example program by using AioSingleAo

Example program by using AioMultiAo


Example program by using AioSingleAo

//---------------------------
// Variable declaration

//---------------------------

long Ret;              //Return values of functions
short Id;              //ID
char ErrorString[256]; //Array for storing error string

//---------------------------
// Initialize device
// Devicename : Aio000
//---------------------------

Ret = AioInit( "Aio000" , &Id );
if( Ret != 0 ){
    AioGetErrorString( Ret , ErrorString );
    TRACE( "AioInit : %s\n" , ErrorString );
    exit( 0 );
}

//---------------------------
// Set analog output range
// Range : -10 to 10V
//---------------------------

Ret = AioSetAoRangeAll( Id , PM10 );
if( Ret != 0 ){
    AioGetErrorString( Ret , ErrorString );
    TRACE( "AioSetAoRangeAll : %s\n" , ErrorString );
    Ret = AioExit( Id );
    exit( 0 );
}

//---------------------------
// Analog output form the specified channel only once
// Output channel : 0
// Output data : 800H
//---------------------------

Ret = AioSingleAo( Id , 0 , 0x800 );
if( Ret != 0 ){
    AioGetErrorString( Ret , ErrorString );
    TRACE( "AioSingleAo : %s\n" , ErrorString );
    Ret = AioExit( Id );
    exit( 0 );
}
TRACE( "Channel0F%d\n" , 0x800 );

//---------------------------
// Device exit
//---------------------------

Ret = AioExit( Id );
if( Ret != 0 ){
    AioGetErrorString( Ret , ErrorString );
    TRACE( "AioExit : %s\n" , ErrorString );
    exit( 0 );
}


Example program by using AioMultiAo

//---------------------------
// Variable declaration

//---------------------------

long Ret;              //Return values of functions
short Id;              //ID
char ErrorString[256]; //Array for storing error string
long AoData[8];        //Conversion data
short i;

//---------------------------
// Initialize device
// Devicename : Aio000
//---------------------------

Ret = AioInit( "Aio000" , &Id );
if( Ret != 0 ){
    AioGetErrorString( Ret , ErrorString );
    TRACE( "AioInit : %s\n" , ErrorString );
    exit( 0 );
}

//---------------------------
// Set analog output range
// Range : -10 to 10V
//---------------------------

Ret = AioSetAoRangeAll( Id , PM10 );
if( Ret != 0 ){
    AioGetErrorString( Ret , ErrorString );
    TRACE( "AioSetAoRangeAll : %s\n" , ErrorString );
    Ret = AioExit( Id );
    exit( 0 );
}

//---------------------------
// Analog output from multiple channels only once
// Number of output channels : 8
//---------------------------

for( i = 0 ; i < 8 ; i++ ){
    AoData[ i ] = i * 100;
    TRACE( "Channel%dF%d\n" , i , AoData[ i ] );
}

Ret = AioMultiAo( Id , 8 , &AoData[ 0 ] );
if( Ret != 0 ){
    AioGetErrorString( Ret , ErrorString );
    TRACE( "AioMultiAo : %s\n" , ErrorString );
    Ret = AioExit( Id );
    exit( 0 );
}

//---------------------------
// Device exit
//---------------------------

Ret = AioExit( Id );
if( Ret != 0 ){
    AioGetErrorString( Ret , ErrorString );
    TRACE( "AioExit : %s\n" , ErrorString );
    exit( 0 );
}