beautypg.com

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

Page 95

background image

Chapter 8

Block Transfer

8-5

bt_que

Use this routine to initiate a BT. This routine adds a BT to the pending list
and interrupts the scanner to pass it the command.

Calling sequence:

status = bt_que(

command, address, &packet

);

Arguments:

command:

an integer, either C_BT_READ or C_BT_WRITE.

address:

an integer, the module or slot address (0–127), formed by

multiplying the rack address (0–7) by 16 and adding the slot address
(0–15). Equivalent arithmetic would be rack times 16, plus group times
2, plus 1 for right–hand slot or 0 for left–hand slots.

packet:

a pointer to a QBT structure where you have filled in the

length of data (and the data, for a write BT).

Returned values:

error

status,

OK

if the request was successfully entered in the queue or

NOT_OK if the queue was full or the request was invalid. This is the
status of queuing the request, not of executing it. Your program can
determine the latter status by examining the qbt_stat field in the packet.

Example:

static QBT btr;
#define CHANNEL_IN (16*2 + 3) /* slot 3, rack 2 */

. . .

btr.qbt_len = 15;
if ( bt_que(C_BT_READ, CHANNEL_IN, &btr) )

printf(“can’t queue the read BT\n”);