

I2C bus is the weakest link, on this PLC and on any Arduino. Even in the main PLC scan sequence, we run a system diagnostic check on every scan.
Click plc using rtc update#
Simple diagnostic checks like I/O board logic power (checked by polling a spare input photo isolator), I2C addressing checking and a 2 second RTC update checking is all that is needed to verify that all devices are functional and 100% working. The system watchdog will not be reset and no control output action will take place until all system devices and peripherals are 100% operational.

On reset, reboot or power on reset, the system startup routines thoroughly checks for any device or peripheral failure.
Click plc using rtc software#
The extremely useful Arduino function millis() command which is used throughout our control software to detect any delays in the overall PLC scan sequence performance. If a input or control action takes too long, in execution, the PLC will halt and an error is generated. We tried to closely mimic a modern PLC by timing each task in the control sketch software. All PLC scan sequence routines are polled and interrupts are not allowed, which could halt the CPU. Reading the inputs (analog or digital), CPU processing the inputs by “if, then, else statements” and other comparison logic and then outputing the results to PLC outputs is all that takes place during each complete “PLC Scan” pass in the main loop(). The PLC scan sequence includes “input scan”, “user program scan” and “output scan”, which works in the microcontroller’s main Loop(). The Home Automation “Gator” PLC uses the same “C” functions. The Arduino “C” functions, made for programming the Arduino and compatible boards, is extremely easy to use. Programmable logic controllers use “relay ladder logic” (RLL) as a preferred PLC programming control language. “Design for reliability and program check for the worst” PLC software programming and hardware tips.
