Rockwell Automation 6008-SV2R VMEbus remote I/O Scanner User Manual

Page 161

Advertising
background image

Chapter

Programming the Scanner

8

8Ć27

/*
**
** PRINT_BT_DATA() –– print contents of bt_data structure
**
**

This routine prints the contents of a bt_data structure, which is used by the

**

queue_oneshot_bt(), oneshot_bt_complete(), configure_continuous_bt(), and

**

continuous_bt_update() routines.

**
**

parameters:

pointer to bt_data structure

**

return value:

none

**
*/

void
print_bt_data (bt_data far *ptr)
{

unsigned short

i;

/* print command–type */
if (ptr–>cmd == CMD_OSBTWRITE) {

fprintf(stdout, ”\tcmd = ONE–SHOT BT WRITE\n”);

} else if (ptr–>cmd == CMD_OSBTREAD) {

fprintf(stdout, ”\tcmd = ONE–SHOT BT READ\n”);

} else if (ptr–>cmd == CMD_CONBTWRITE) {

fprintf(stdout, ”\tcmd = CONTINUOUS BT WRITE\n”);

} else {

fprintf(stdout, ”\tcmd = CONTINUOUS BT READ\n”);

}

/* print tag word */
fprintf(stdout, ”\ttag = %XH\n”, ptr–>tag);

/* print address */
fprintf(stdout, ”\taddress = %XH { rack %d, group %d, slot %d }\n”,

ptr–>addr, ((ptr–>addr & 0x00F0) >> 4),
((ptr–>addr & 0x000E) >> 1), (ptr–>addr & 0x0001));

/* print data length */
fprintf(stdout, ”\tdatalen = %d words\n”, ptr–>datalen);

/* if continuous operation, print irq */
if ((ptr–>cmd == CMD_CONBTWRITE) || (ptr–>cmd == CMD_CONBTREAD)) {
fprintf(stdout, ”\tinterrupting on IRQ %d with vector %XH\n”,

(ptr–>irq & 0x0007), ((ptr–>irq & 0xFF00) >> 8));

}

/* print data buffer */
for (i = 0; i < ptr–>datalen; i++) {

fprintf(stdout, ”\tbuffer[%d] = %XH\n”, i, ptr–>data[i]);

}

return;

}

Advertising
This manual is related to the following products: