206 motion control theory – ADLINK PCI-8258 User Manual

Page 220

Advertising
background image

206

Motion Control Theory

• Example:

In addition, you may use Event handle of win32 by using
APS_int_no_to_handle() after step 1 to convert Event number into
format of win32 Event handle.

• Example:

void

interrupt_example()

{

// This example shows how interrupt functions work.

I32 board_id = 0;

I32 int_no;

// Interrupt number

I32 return_code;

// function return code

I32 item = 0;

// Axis #0 interrupt

I32 factor = ( 1 << 12 );

// bit 12 IMDN interrupt

//Step 1:

姕⭂天䫱⼭䘬ᷕ㕟ḳẞ, factor = IMDN

int_no = APS_set_int_factor( board_id, item, factor, 1 );

//Step 2:

姕⭂ᷕ㕟䷥攳斄

APS_int_enable( board_id, 1 );

// Enable the interrupt main switch

//Step 3:

䫱⼭ᷕ㕟妠䘤

return_code = APS_wait_single_int( int_no, -1 );

//Wait interrupt

if

( return_code == ERR_NoError )

{

//Interrupt occurred

//Step 4:

慵伖ᷕ㕟䁢妠䘤䉨ン

APS_reset_int( int_no );

}

// Step 5:

斄攱ᷕ㕟ḳẞ␴ᷕ㕟䷥攳斄

APS_set_int_factor( board_id, item, factor, 0 );

APS_int_enable( board_id, 0 );

}



Advertising
This manual is related to the following products: