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

Chapter 5
Startup, Status, and Shutdown
5-8
Table 5.A lists all of the bit fields in the global variable g_op_stat:
Table 5.A
g_op_stat bit field descriptions
Bit Field:
Hex Value: Description:
SO_RUN
04 (hex)
The scanner is in run mode.
SO_PROGRAM
01 (hex)
The scanner is in program mode.
SO_TEST
02 (hex)
The scanner is in test mode.
SO_DEBUG
08 (hex)
The scanner is in debugging mode (scanner watchdog disabled).
For more on the scanner watchdog, see chapter 2., Scanner
Watchdog. For debugging mode, see chapter 7, Setup.
SO_BT_PEND
20 (hex)
One or more block transfers are pending in the scanner's queue.
SO_FAULT
40 (hex)
One or more adapters are in fault state.
SO_CHG_FLT
80 (hex)
The fault state of one or more adapters has changed. (This bit
must be reset by your program; the driver never resets it.)
SO_OIT_ERR
10 (hex)
If set, this bit indicates that your program has written one or more
valid module control bytes to the output image table, causing one
or more unsolicited block transfers. (Once set on, this bit remains
on until the user program resets it.) Please see chapter 8,
Unsolicited Block Transfer, for more information.
As mentioned previously, the SO_CHG_FLT and SO_OIT_ERR bits are
set by the driver but can only be reset by your program. Periodically,
probably once per program scan, your program should monitor these bits.
If the fault-change bit, SO_CHG_FLT, is set, your program should then
check SO_FAULT to determine the nature of the change. If the fault bit is
not set, the nature of the fault change was that the last faulted adapter came
back on line. But if the fault bit is set, your program should probably
execute a link status command (see chapter 7, Autoconfigure and Link
Status Information) to check which adapters are faulted. Here’s some
sample code, to be executed once per program scan:
if ( SO_CHG_FLT & g_op_stat ) {
g_op_stat &= ~SO_CHG_FLT;
if ( SO_FAULT & g_op_stat ) {
mr_wait(C_LINKSTAT, &link_pkt);
/* code to examine adapter status goes here */
}
}
In the first line of this example we test whether the fault state of any
adapters has changed; if so, we reset the fault-change bit. In the third line
we test the fault bit, and if any adapters are faulted we execute a link status
call to find out which ones. After the link status call, you would put code
to test the fault bits for each adapter, as explained in chapter 7,
Autoconfigure and Link Status Information.
For testing and resetting the SO_OIT_ERR bit (output image table
programming error), please see chapter 8, Unsolicited Block Transfer.