ADLINK PCI-8258 User Manual
Page 221
Motion Control Theory
207
PCI-8254 / PCI-8258
#include
// Using event handle
#include
"APS168.h"
#include
"ErrorCodeDef.h"
void
interrupt_with_win32_example()
{
// This example shows how interrupt functions work.
I32 board_id = 0;
I32 int_no;
// Interrupt number
DWORD return_code;
// function return code
I32 item = 0;
// Axis #0 interrupt
I32 factor = ( 1 << 12 );
// bit 12 IMDN interrupt
HANDLE handle;
//Step 1:
姕⭂天䫱⼭䘬ᷕ㕟ḳẞ, factor = IMDN
int_no = APS_set_int_factor( board_id, item, factor, 1 );
handle = APS_int_no_to_handle( int_no );
//Step 2:
姕⭂ᷕ㕟䷥攳斄
APS_int_enable( board_id, 1 );
// Enable the interrupt main switch
//Step 3:
䫱⼭ᷕ㕟妠䘤
return_code = WaitForSingleObject( handle, INFINITE );
if
( return_code == ERR_NoError )
{
//Interrupt occurred
//Step 4:
慵伖ᷕ㕟䁢䁢妠䘤䉨ン
ResetEvent( handle );
}
// Step 5:
斄攱ᷕ㕟ḳẞᷕ㕟䷥攳斄
APS_set_int_factor( board_id, item, factor, 0 );
APS_int_enable( board_id, 0 );
}