Allen-Bradley 1784-KTX Reference Manual page 91

Table of Contents

Advertisement

Appendix B
Programming Examples
/***************************************************************************
**
**
**
**
The main loop writes data into the output image table for each of
**
the adapters that are in the scan list.
**
in data for one adapter.
**
is initiated.
It waits for completion of the BT before continuing
**
which is useful for these examples, but not practical in a real
**
application.
**
***************************************************************************/
while (ktx_alive) {
/**** Write the output image table for 0x04 (full rack) ****/
for (i=0, out.count = FULL_RACK_SIZE; i< out.count; i++) out.data[i]++;
status = put_output_data (dp, 0x04, &out);
/**** Write the output image table for 0x0E (half rack) ****/
for (i=0, out.count = HALF_RACK_SIZE; i< out.count; i++) out.data[i]++;
status = put_output_data (dp, 0x0E, &out);
/**** Write the output image table for 0x13 (quarter rack) ****/
for (i=0, out.count = QUARTER_RACK_SIZE; i< out.count; i++) out.data[i]++;
status = put_output_data (dp, 0x13, &out);
/**** Read the input image table ****/
status = get_IO_data(dp, 0x04, &in, INPUT_TABLE);
/**** Initiate a BT Read and a BT Write ****/
/**** BT Read 32 words from slot 15,
/**** then BT write same data to slot 13 ***/
/**** if the BT read was successful
/**** Assume that in.data[4] can change ****/
if (in.data[4] & 0x0100)
bt_buffer.count = 32;
status = bt_read (dp, 15, 0x04, &bt_buffer,
if (status == SUCCESS)
status = bt_write (dp, 13, 0x04, &bt_buffer,
}
}
/**** Reset the old interrupt handler before exiting */
setvect(CLOCK_INTR, oldhandler);
/**** Turn off watchdog ****/
dp–>host_dead_counter = 0;
dp–>alive_flag = HOST_ALIVE;
/**** Deassert the KTX ****/
dp–>deassert_reg = TRUE;
exit (FAIL);
}
Allen-Bradley Parts
B-12
MAIN LOOP
It also looks for a change
If a certain value appears, a BT command
****/
****/
{
++trans_count, BT_READ_TMO);
++trans_count, BT_WRITE_TMO);
**
**
**
**
**
**
**
**
**
**

Advertisement

Table of Contents
loading

This manual is also suitable for:

1784-ktxd1784-kts

Table of Contents