beautypg.com

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

Page 99

background image

Chapter 8

Block Transfer

8-9

Packet Check

Your program can periodically check the qbt_stat field of your packet. As
long as the field is equal to SC_PENDING, the scanner still has the BT in
its queue. As soon as the packet status changes to any other value, it is the
actual completion status passed by the scanner.

A list of status values is in ”Confirmation Status Codes” in this chapter,
but for a first approximation all that matters is whether the status is
SC_OK (successful completion) or anything else.

Ordinarily your program would do other things while waiting for the BT to
finish. You could start up other BTs, do discrete I/O, issue management
requests, or a combination of these. But at some point in your program
scan you need to test for completion of this BT:

if ( pkt.qbt_stat != SC_PENDING ) {

if ( pkt.qbt_stat == SC_OK ) {

/* successful completion */

}
else {
/* BT failed; pkt.qbt_stat contains reason */
}

}