Modbus TCP slave (PLC) Is diconnecting due to watchdog timer?
I've set up my PLC as a Modbus TCP slave, from which i interface via some python code. The python code act as a modbus client, but the PLC sometimes terminates when the client requestes information with this window popping up.
"runtime error #16 (watchdog expired Task = default task)"
And a error message stating:
IEC Task 0 ' cycle time is greater than the set watchdog timer; or cycle time exceeded, but shorter than watchdog timers
The code on the PLC consist of only these lines of code:
(*Bit0 := TRUE;*)
(*Bit1 := TRUE;*)
(*Bit2 := TRUE;*)
DO1 := Bit0; (* Start/Stop *)
DO2 := Bit1; (* Direction [False - Reverse ; True - Forward] *)
DO3 := Bit2; (* Speed [Fast = 11; Medium = 10; Slow = 01 ; Stop = 00] *)
DO4 := Bit3; (* Speed [Fast = 11; Medium = 10; Slow = 01 ; Stop = 00] *)and that it. Bitx are coil address and DOx are digital outputs on the PLC.
These pins work, but this random error is just annoying? What is the cause, and how do i remove it?
Voted best answer
If that is AC500, you may be have to set a fixed cycle time for the application, where the code for communication is created - for example 100 ms. I have has some problems with Modbus, until I started to use only fixed cycle times for that type of applications.
Also you have to increase the watchdog timer (or remove it).
Tasks definition is in a special tab in CoDeSys editor.