beautypg.com

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

Page 50

background image

Chapter 5

Startup, Status, and Shutdown

5-7

This section tells you about three ways your program can monitor the
status of the scanner:

Global

variable

g_op_stat

contains status bits that tell you the current

scanner operating mode and fault conditions. You can use the function
xlat_opst to convert the status bits to English.

Global

variable

g_act_scnr

is positive as long as the scanner is still in

communication with the host.

Function

fatal_6008

returns a code to describe the nature of the scanner

shutdown after it is no longer communicating with the host.

g_op_stat

At any time after the initial call to setup_6008 or start_6008, your
program can monitor the unsigned variable g_op_stat. This variable is a
set of bit fields, and you can test for a particular condition by ANDing a
symbolic constant with g_op_stat.

For instance, SO_FAULT is the symbolic name of the bit field that is true
(nonzero) when any adapters are faulted. To find out if any adapters are
faulted, your program would use this statement:

if ( SO_FAULT & g_op_stat )

/* one or more adapters are faulted */

else

/* no adapters are faulted */

Scanner Status