Polling for completion – Rockwell Automation 6008-SI IBM PC I/O SCNNR 6008-SI User Manual
Page 98

Chapter 8
Block Transfer
8-8
Number of Scans
The total number of scans needed to empty the scanner’s BT queue is
equal to the largest (effective) number of scans needed to service all of the
BTs queued to any single adapter. In other words, determine the effective
number of scans each individual adapter needs, then use the largest one.
The following is a procedure to determine the number of scans any
individual adapter needs. Remember that a single adapter, containing more
than eight slots and using single slot addressing, appears to the scanner as
two distinct adapters.
If none of the BTs are queued to any given module more than once, then
the number of scans is equal to the total number of BTs plus one. For
example, if four BTs are queued to four different modules, then the
number of scans needed to service all of the BTs queued to that adapter
is five. (4 BTs + 1 = 5 scans)
If more than one BT is queued to a given module, then two scans per
BT must be used. If more than one module has multiple queued BTs,
then the number of scans needed is equal to the largest number for any
module. For example, an adapter has five BTs queued to it, two of them
going to one module and three to another. The number of scans to
service that adapter is six. (3 BTs x 2 scans per BT = 6 scans)
At this point, you know the number of scans needed to service each
individual adapter. However, for the calculation of the time to empty the
scanner’s queue, the effective number of scans is required. The effective
number of scans is equal to the number of scans divided by the number of
times the adapter appears in the scanner’s scan list. For example, if the
number of scans to service an adapter’s BTs is 11, and the adapter appears
in the scan list four times, then the effective number of scans to service that
adapter is 2.75. (11 scans / 4 entries = 2.75 effective scans).
The effective number of scans to use to determine the total time to empty
the scanner’s queue is the largest effective number of scans for any
individual adapter.
Once your program has queued a BT, you must check periodically to see
whether the scanner has finished it. (Why? The scanner interrupts the host
to pass back completion status, but this goes on in background as far as
your program is concerned. So the status in the packet seems to change
while your program is executing.)
There are two ways to poll for completion: by examining the packet and by
using the bt_done macro.
Polling for
Completion