Qbt data structure (packet) – Rockwell Automation 6008-SI IBM PC I/O SCNNR 6008-SI User Manual
Page 92

Chapter 8
Block Transfer
8-2
Meanwhile, your program is periodically polling for completion of the
BT, either by examining the packet directly or by using the bt_done
macro.
When the BT is complete, or if it is not finished within 4 seconds after it
was queued, the scanner interrupts the host with a confirmation status
and the length of data actually transferred. For a read BT, if the BT was
successful the scanner also passes the data that it read.
The interrupt handler writes the confirmation status, length of data, and
(for a read BT) data to your program’s packet. Again, you can think of
this as taking place in background.
The next time your program polls for completion, it finds that the BT is
finished and can examine the status to determine whether it succeeded.
For a successful read BT, your program can then make use of the data.
In the following sections we’ll be taking a closer look at these steps.
When you initiate a BT, you pass a packet to the library routines. The
packet is a defined type of QBT. You should declare it static unless you
have good reason not to: see the “Programmer Alert” below.
The QBT defined type is a structure that includes the following fields, all
of type unsigned integer, in addition to a field of concern only to the
library routines:
qbt_stat
confirmation status; see ”Confirmation Status Codes” later in this chapter
for a complete list. The library routines initialize this to SC_PENDING,
and change it to the actual confirmation status when a reply is received
from the scanner. Your program can determine whether the BT is done by
testing this field for equality to SC_PENDING or by calling the macro
bt_done. See ”Polling for Completion” later in this chapter.
qbt_len
length of data in words, up to 64. A value of 0 (zero) is permitted and tells
the module to decide how many words to transfer (never more than 64).
The number of words actually transferred is always left in this field after
the BT has finished or timed out; in case of timeout or other error, this field
is set to zero. After completion, the value is from 0 to 64.
QBT Data Structure (Packet)