Allen-Bradley 1784-KTX Reference Manual page 99

Table of Contents

Advertisement

Appendix B
Programming Examples
/***************************************************************************
**
**
UBYTE set_scan_list (KTX_DUALPORT far *dp, SCAN_LIST *sl, UBYTE *orphan,
**
**
**
This routine instructs the KTX scanner to replace the existing scan
**
list with the new one specified in the command.
**
list would create a fault dependent groupt (FDG) orphan, the orphan's
**
address is copied to the caller in addition to the status code.
**
**
INPUT
**
KTX_DUALPORT far *dp
**
SCAN_LIST *sl
**
UBYTE *orphan
**
UBYTE trans_num
**
USHORT timeout
**
**
OUTPUT
**
UBYTE status
**
***************************************************************************/
#include "ktx_dp.h"
#include "ktx_err.h"
#include "ktxconst.h"
UBYTE set_scan_list (KTX_DUALPORT far *dp, SCAN_LIST *sl, UBYTE *orphan,
{
UBYTE
status;
/**** Initialize the command buffer ****/
dp–>cmd_buffer.host_command = SET_SCAN_LIST;
dp–>cmd_buffer.transaction_num = trans_num;
dp–>cmd_buffer.command_length = 1 + sl–>count;
dp–>cmd_buffer.cmd.set_scan_list = *sl;
/**** Send the command ****/
dp–>int_status_from_host = SCANNER_COMMAND_FROM_HOST;
dp–>host_to_ktx_int_reg = INTERRUPT_KTX;
/**** Get and process the confirmation
status = get_confirmation(dp, trans_num, timeout);
switch (status) {
/* break if no confirmation was available */
case CONFIRMATION_TIMED_OUT:
break;
/* break if the transaction numbers didn't match */
case TRANS_NUM_MISMATCH:
break;
/* If an adapter became a FDG orphan, copy
/* orphan's address to caller. */
/* (fall through to acknowledge confirmation) */
case SCAN_LIST_CAUSES_FDG_ORPHAN:
*orphan = dp–>confirmation_buffer.conf.set_list.orphan;
acknowledge_confirmation(dp);
break;
Allen-Bradley Parts
B-20
setscanl.c file
UBYTE trans_num, USHORT timeout)
– points to the base of the KTX dualport
– the scan list to be sent to the KTX
– where orphan's address is to be written
– transaction_number
– time (in seconds) to wait for completion
– completion status of the command
/* 1784–KTX scanner dualport definition
/* 1784–KTX scanner error codes
/* 1784–KTX scanner constants
UBYTE trans_num, USHORT timeout)
****/
*/
If the new scan
*/
*/
*/

Advertisement

Table of Contents
loading

This manual is also suitable for:

1784-ktxd1784-kts

Table of Contents