Allen-Bradley 1784-KTX Reference Manual page 55

Table of Contents

Advertisement

#include "ktx_dp.h"
/* 1784–KTX scanner dualport definition */
#include "ktx_err.h"
/* 1784–KTX scanner error codes
#include "ktxconst.h" /* 1784–KTX scanner constants
UBYTE bt_write
(KTX_DUALPORT far *dp, UBYTE slot_number, UBYTE link_address, BT_BUFFER *bt_buf,
UBYTE trans_num, USHORT timeout)
{
UBYTE
status;
int
i,size;
/**** Initialize the command buffer ****/
dp–>cmd_buffer.host_command = BT_WRITE;
dp–>cmd_buffer.transaction_num = trans_num;
/**** Copy entire BT buffer if length is ****/
/**** set to ADAPTER_DECIDE_LENGTH
if (bt_buf–>count == ADAPTER_DECIDE_LENGTH)
size = 64;
else
size = bt_buf–>count;
dp–>cmd_buffer.command_length = 3 + (2*size);
dp–>cmd_buffer.cmd.bt_write.module_slot_address = slot_number;
/**** Convert link address to logical rack address ****/
dp–>cmd_buffer.cmd.bt_write.logical_rack_address = link_address >> 2;
dp–>cmd_buffer.cmd.bt_write.bt_data_length = bt_buf–>count;
for (i=0; i<size; i++)
dp–>cmd_buffer.cmd.bt_write.bt_data[i] = bt_buf–>bt_data[i];
/**** Send the command ****/
dp–>int_status_from_host = SCANNER_COMMAND_FROM_HOST;
dp–>host_to_ktx_int_reg = INTERRUPT_KTX;
/**** Get and acknowledge the confirmation
status = get_confirmation(dp, trans_num, timeout);
if ((status != CONFIRMATION_TIMED_OUT) && (status != TRANS_NUM_MISMATCH))
acknowledge_confirmation(dp);
return status;
}
Allen-Bradley Parts
Example 5.A
*/
*/
****/
****/
Chapter 5
Issuing Block Transfer Commands
5-5

Advertisement

Table of Contents
loading

This manual is also suitable for:

1784-ktxd1784-kts

Table of Contents