beautypg.com

Host watchdog – Rockwell Automation 6008-SI IBM PC I/O SCNNR 6008-SI User Manual

Page 49

background image

Chapter 5

Startup, Status, and Shutdown

5-6

Please refer to the Host Watchdog section in chapter 2, I/O Scanner
Concepts. That section explained the general concepts, this section
explains the specific programming steps.

host_active

This macro sets the host watchdog to a user- specified interval or to the
default.

By default, your program must call the host_active macro at least once a
second (18 units of 55 ms). You can select a different interval in any
host_active call, to be effective for that call only.

Calling sequence:

host_active(

interval

);

Arguments:

interval:

a positive integer specifying the interval, zero to select the

default interval, or a negative value to disable the watchdog. Please see
the discussion below.

Returned values:

none.

g_act_host

When you call host_active, the specified positive number (or 18 if the
actual argument is zero) is placed in the global variable g_act_host.
Then every 55 ms the timer interrupt counts g_act_host down a notch.
When the scanner interrupts the host, the interrupt handler checks
g_act_host and if it’s negative the interrupt handler infers that the host
program is not active. The scanner goes off the link within 50 ms, all
adapters go inactive, and output terminals go to last state or reset. So your
program could bypass the host_active macro and just update g_act_host,
but the macro provides convenient program documentation.

You can disable the host watchdog by a one-time call to host_active with a
negative argument (which stores 0 in g_act_host). This may be
appropriate for strictly monitoring applications, but it’s almost certainly a
bad idea for control applications. You should be aware that disabling the
watchdog overrides the last state or reset switches and effectively sets all
discrete outputs at last state in case of a program failure.

Host Watchdog