Allen-Bradley 1784-KTX Reference Manual page 90

Table of Contents

Advertisement

exit(FAIL);
}
sscanf(&argv[1][2], "%4X", &segment);
if (segment == NULL) exit(FAIL);
dp = (KTX_DUALPORT far *) MK_FP(segment, 0x0000);
/**** Initialize the KTX scanner ****/
if (initialize_KTX (dp, LINK_57_KBAUD, INIT_TMO) != SUCCESS) {
printf("\nScanner initialization failed.
exit(FAIL);
}
/**** Perform an autoconfiguration and check results ****/
status = autoconfigure (dp, ++trans_count, AUTO_TMO_57);
status = get_scan_list (dp, &auto_scan_list, ++trans_count, GET_SCAN_TMO);
if (auto_scan_list.count != expected_scan_list.count)
printf ("\nAutoconfigure returned unexpected configuration.");
else
for (i=0; i < auto_scan_list.count; i++) {
if (auto_scan_list.scan_list[i] != expected_scan_list.scan_list[i]){
printf ("\nAutoconfigure returned unexpected configuration.");
break;
}
}
/**** Set up the scan list ****/
status = set_scan_list (dp, &runtime_scan_list, ++trans_count, SETSCAN_TMO_57);
/**** ENABLE /****
Set the fault dependent group
/**** First, clear the data structure ****/
/**** then place 0xe and 0x13 in the
/**** same fault dependent group.
for (i=0; i < 128; i++) {
fdg[i].fg_number = 0;
fdg[i].in_fault_group = FALSE;
}
fdg[0x0E].fg_number = fdg[0x13].fg_number = 1;
fdg[0x0E].in_fault_group = fdg[0x13].in_fault_group = TRUE;
status = set_fault_dependent_group (dp, (SET_FAULT_GROUP_CMD *) &fdg,
++trans_count, SET_FDG_TMO);
/**** Go to TEST mode to check operation ****/
status = set_mode (dp, TEST, ++trans_count, SET_MODE_TMO);
if (dp–>operating_status.test_mode != TRUE)
printf("\nFailed to change mode to TEST.");
if (dp–>operating_status.fault_exists == TRUE)
printf("\nAt least one adapter is faulted.");
WATCHDOG TIMER OPERATION
*****
***** The PC's clock interrupt occurs at approximately 50ms intervals.
***** The KTX's clock interrupt occurs at approximately 20ms intervals.
***** Set the host_dead_counter value to (wdg_preset * 5).
***** example, after 10 PC ticks (~500ms), the PC will clear the alive_flag.
***** The KTX will test the alive_flag after 50 KTX ticks (1000ms).
***** margin of error is intentionally high since PCs are not know to
***** be very accurate at timing tasks.
****/
ktx_alive = TRUE;
oldhandler = getvect(CLOCK_INTR);
wdg_accum = 0;
wdg_preset = 10;
dp–>host_dead_counter =
wdg_preset * WDG_SCALER; /* KTX counts 50
setvect(CLOCK_INTR, KTX_watchdog);
Error code: %d",dp–>init_status);
****/
****/
****/
In this
/* local variable
/* save old vector
/* clear current wgd count
/* Host counts 10 interrupts */
*/
/* install new interrupt
/* service routine
*/
Appendix B
Programming Examples
This
*/
*/
*/
*/
B-11

Advertisement

Table of Contents
loading

This manual is also suitable for:

1784-ktxd1784-kts

Table of Contents