How to scan for PLC when an exception occurs?

How to scan for PLC when an exception occurs?
none 0.0 0

HMI - cMT3108xp
Weintek Codesys

My Codesys program resulted in an exception below. I don’t remember the offset number but I copied this from a Codesys forum where someone had run into the same issue. The posted solution was to change the watchdog timer, but I don’t have that enabled. So that solution won’t help me.

Exception: SOURCEPOSITION App[myApp] area=0, offset= some number
Exception: EXCEPTION [watchdog] occured: App[Application], Task=[Task].

After making a few changes I thought might fix it, now Codesys can’t scan and find the HMI. I know I’m connected fine because I can ping it and access it via web browser.

Even restarting the computer didn’t help. What would be the approach to resolve the scan not finding my HMI?

Hi @JDControlsLLC,

Can you please post a screenshot of this exception for our reference? Also, if the PLC application has crashed due to an exception, you may need to reboot the HMI to recover it from an error state.

I can’t grab a screenshot because I’d already tried restarting my PC and now can’t go online because it won’t find the device during a scan.

Just reset the HMI, reconfigured the IP address to what it was before (LAN2) and downloaded the Easy Builder Pro project again. All that went well, but Codesys still cannot find the device.

@JDControlsLLC,

We can address the exception issue separately at a later time. Just to confirm, can you please let me know what option you are using to scan for CODESYS?

There are two methods within the device tab that may be used to scan for CODESYS enabled controllers. However, it is important to note that:

  • (1) within the image below will only work when you are connected to LAN 1.
  • (2) within the image below will work if you are connected to either LAN 1 or LAN 2.

I’m using option 2 and am connected to LAN 2

My PC can ping the HMI

@JDControlsLLC,

Can you please double check that the “CODESYS login” is enabled within the HMI’s settings menu?

This option should be located within the “CODESYS” tab under [Modify Ethernet(LAN 1)]:

Well that was the issue now. I forgot to turn that back on after resetting the HMI.

However, I am positive I checked that yesterday and still couldn’t connect after the odd exception was showing up.

It works now so I can do some troubleshooting on that exception. If I can’t figure it out, I’ll start another thread with screenshots of the error messages and we’ll go from there. Thanks.

Happy to help - and CODESYS documentation is heavily community driven, so your posts will surely help other users. Thanks for chiming in!

Sometimes, when an exception occurs and the “Watchdog” in a task is disabled, the CODESYS application will enter an “Error” state and refuse outside connections. When this happens, you may power-cycle the HMI, and assuming the exception is not code related such as due to an infinite loop or invalid conversion, the application state should recover and permit login.

However, if the application crashes again, you may need to reset CODESYS and test your project with the “Watchdog” enabled in your “Task” object to determine what is causing the crash to occur. The Watchdog should prevent CODESYS from entering an “Error” state due to a runtime exception and simply stop the application instead…

Brendon,

This gremlin seems to have come back. I’ve reset Codesys, reset the HMI, downloaded the HMI project to it, enabled Codesys login, but still can’t find the device via scanning in Codesys.

All I did was change the declaration of a variable inside of a Function Block from a VAR_INPUT to a VAR_IN_OUT. I realize this requires reimporting tags into the HMI project but that also didn’t solve the issue.

The application, Codesys, and Login all say error still from the HMI’s web access. No matter how many cycles of resetting everything, enabling Codesys login, and downloading the HMI application to it, I still have the below screenshot and Codesys will not find the HMI.

Cancel that, Brendon. I got it working now.

Not sure if you can help with this or not, but the issue that causes everything to fault is related to the order in which I’m calling a few MAIN routines.

The code compiles just fine, gives no errors, not even a warning.

However, something about it Codesys doesn’t like and it faults out everything. About 5 seconds after downloading it kicks me offline and then everything is in “error” state. Without any error/warning I have no clue what the issue is.

Good morning @JDControlsLLC!

I should be able to assist with this, can you please send me your project file via email? I believe you still have my email address.

Sending it shortly, thanks!