wApcCount = 0 ;
if( DIO_DriverInit() != 0 )
return
MyErr(
"Driver Initialize Error!!" );
else
cout << "Driver Initialize OK!!" << endl;
if( DIO_RegisterApc(RegisterApcFunction) != 0 )
return MyErr( "Register APC Error!!" );
else
cout << "Register APC OK!!" << endl;
if ( DIO_InstallIrq(wBase,static_cast<WORD>( nIRQ ) ) != 0 )
return
MyErr(
"Interrupt Install Error!!" );
else
cout << "Interrupt Install OK!!" << endl;
DIO_ResetIntCount();
for (int i=0;i<10;i++)
{
//
****************************************************************
// The user could replace the internal trigger by external trigger.
//
****************************************************************
cout << " Trigger interrupt" << endl;
// Make the DO16 to high then low to generate the interrupt signal
// for IRQ3,4,5,6,7 Connect the DO16 with DI16(Interrupt Source) to
// enable Interrupt
DIO_OutputByte( (wBase + 2), 1);
Sleep( 100 );
DIO_OutputByte( (wBase + 2), 0);
Sleep( 100 );
// Make the Output-Channel-0 to high then low to generate the
// interrupt signal for IRQ9,10,11,12,14,15 Connect the DO0 with
// DI0(Interrupt Source) to enable Interrupt
DIO_OutputByte( wBase, 1 );
Sleep( 100 );
DIO_OutputByte( wBase, 0 );
Sleep( 100 );
cout << "Waiting for an asynchronous procedure call(APC) is queued to
the thread." << endl;
SleepEx(INFINITE ,TRUE);
cout << " Got the APC!!" << endl << endl;
//***** Do some thing in here ****
// :
}
WORD dwIntCount;
//*** How many times the interrupt occur ***
if( DIO_GetIntCount(&dwIntCount) != 0 )
return MyErr( " Get Interrupt Counter Error !!!" );
else
cout << "Interrupt Counter: " << dwIntCount << endl;
DIO_DriverClose();
cout << "Driver Close" << endl;
return (1 - MyErr( "" ));
}
ISO
-P32C32/P32S32W/P64/C64 User Manual (Ver.1.9, Oct. 2011, IMH-000-19)
54