198 motion control theory – ADLINK PCI-8258 User Manual

Page 212

Advertising
background image

198

Motion Control Theory

3. Reset timer continuously

After the watchdog protection mechanism is enabled, the

watchdog mechanism should be reset within timeout period

to rest the timer and retiming from beginning. In case of

timer timeout relevant events are triggered per setting given

by step 1.
Use APS_wdt_reset_counter () to reset watchdog.

• Example:

void

watchdog_example()

{

// This example shows how interrupt functions work.

I32 board_id = 0;

I32 timer_no = 0;

// Only timer 0 to be used

I32 time_out = 10;

// Time out is 10*100 ms = 1 sec

I32 EventByBit = 0x01;

// Action event is defined by bit.

// Bit0: Motor servo off

// Bit1: Digital output off

// Bit2: PWM off

I32 ret = 0;

// return code

//Step 1:

姕⭂妰㗪☐妠䘤⼴䘬ḳẞ

ret = APS_wdt_set_action_event( board_id, timer_no, EventByBit );

//Step 2:

┇≽䚳攨䉿ᾅ嬟㨇⇞

ret = APS_wdt_start( board_id, timer_no, time_out );

//

ἧ䓐侭䘬timer炻while loop炻ㆾ侭㗗⎗⚆ㅱ溆

timer(500ms)

//

㭷500ms⍣慵伖ᶨ㫉妰㗪☐

{

//Step 3:

ᶵ攻㕟䘬慵伖妰㗪☐

ret = APS_wdt_reset_counter( board_id, timer_no );

…Do Something

}

}

Advertising
This manual is related to the following products: