Subroutine Loop Watchdog Fault


Thread Starter


I am writing a data transfer routine between a SLC 5/04 and BASIC Module but I seem to need a loop in my data transfer subroutine to allow all of the data to transfer from the BASIC to the SLC. I am using simple data transfer rungs similar to the Allen Bradley BASIC Language Reference Manual page 13-7 for the Call 22. This program works in the main Ladder #2 but needs to be put into a subroutine to integrate with other logic, which will not work for me.

The problem is that I loop back to the start of the subroutine to perform the logic again but the user watchdog times out every time and I get zero data transferred.

I've implemented a counter to limit the loops and have increased the watchdog time but neither of these have allowed any data to transfer. Is there any way to get this logic to run the correct number of times to allow some data to move around?

Thank you for your help.

david mertens

In real time systems, you should not program any loops, especially no loops that can't terminate before the end of the allowed cycle time. (Any while ... or repeat ... until or for ... next construction that does not finish in a very limited amount of time) the operating system itsself will execute the programm in a loop anyway, the only thing you have to do is use counters that increase each cycle and keep track of the counting value. Use if ... then ... else ... and case... constructions instead of loops. As your program is executed every cycle, it's very important to make it's execution time predictable and short.