ryannn
Hello, 
I understand that many PLCs have a self-diagnostic function. I want to know if OPENPLC implemented on Arduino has this function or a similar one.

kind regards,
Ryannn
Reply 0 0
ryannn
Hi, 
I have looked through the source code and found that there are no functions related to “self-diagnostic features” within the“ plcCycleTask() function”(as shown in the screenshot below).
[203128%2F8694103%2Fmceclip0]
Does this mean that OPENPLC does not have this functionality?🙂
Reply 0 0
thiagoralves
Yes, there aren’t any self diagnostic functions. I’m thinking about having some basic watchdog implemented, but the variety of hardware platforms with different peripherals makes it a bit complicated. Maybe I’ll add a generic software watchdog that can be adapted to all platforms.
Reply 0 0
thiagoralves
Do you have suggestions? Any help is appreciated ☺️
Reply 0 0
ryannn
Hi, thiagoralves!
Yes, I agree that using a watchdog timer is a good idea. Also, I'd like to consult you a question: Does the implementation of OPENPLC completely omit the use of watchdogs? For instance, utilizing a watchdog timer to implement timeout resets for cyclic scans?
Reply 0 0
thiagoralves
It uses hardware timers to keep track of the scan cycles, but not watchdogs. A watchdog would reset the board if a certain criteria is met (for example, taking too long on a scan cycle). The main issue here is that different boards implement watchdog differently. Think about an 8-bit AVR Arduino Uno and an ESP32 or STM32. I couldn't find a watchdog library that would encompass all these architectures. So what I'm thinking about doing is creating some kind of universal watchdog library first, and then integrate that on OpenPLC.
Reply 0 0
ryannn
Hi, thiagoralves!
I'm sorry, I'm not very knowledgeable about multi-architecture development, so it seems I can't be of much help to you, but I think your idea is good! Also, I'd like to confirm with you again: there's no timeout reset function when the scan cycle of OPENPLC is too long, right?
Reply 0 0
thiagoralves
Nope, there isn’t 
Reply 0 0
ryannn
Received, thank you!
Reply 0 0
Reply