beautypg.com

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

Page 53

background image

Chapter 5

Startup, Status, and Shutdown

5-10

g_act_scnr

This sentinel word (type integer) lets your program check periodically that
the scanner is still talking with the host. Here’s how it works.

This word is decremented once every 55ms; on the other hand, the
interrupt handler resets the value to 12 every time an interrupt from the
scanner is processed. Thus g_act_scnr goes negative about 1/3 of a
second (12K x 55ms) after the scanner last talks to the host.

Your program should poll for scanner failure by executing code similar to
the following once per program scan:

if ( g_act_scnr < 0 ) {
print(“\nscanner failure: code %d\n”, fatal_6008( ));
stop_6008( );
abort( );
}

The fatal_6008 and stop_6008 functions are explained later in this chapter.

Note that g_act_scnr goes on decrementing even after the scanner stops
talking to the host, so that it flips from negative to positive about half an
hour later.