AdvancedHMI Software

General Category => Support Questions => Topic started by: ENA on June 28, 2017, 05:23:54 AM

Title: How to handle disconnected PLC?
Post by: ENA on June 28, 2017, 05:23:54 AM
Hello
I'm doing a bit of a code that writes a string to PLC depending on the statuses read from the same PLC, Micrologix 1400.
I got the functionality that I wanted, but I have a problem, which occurs when AdvancedHMI looses connection to PLC, which I simulate by disconnecting the ethernet cable. The error message occurs, as seen in the attachment.

How can I handle this error, so that my application doesn't crash and resumes normal operation, after the PLC is reconnected?
Title: Re: How to handle disconnected PLC?
Post by: ENA on June 28, 2017, 06:07:16 AM
Shortly after posting this topic, I found this thread:
http://advancedhmi.com/forum/index.php?topic=1697.msg9252#msg9252

Anyway, additional advice would be appreciated.
Title: Re: How to handle disconnected PLC?
Post by: Archie on June 28, 2017, 09:41:46 AM
When accessing the driver via code, the rule is to always wrap your code in a Try-Catch block to properly handle any errors.