I have a problem with one function of my conversion from python to Open PLC.
In my Home I am using relay outputs to carry out power resets. (e.g. re boot a webcam).
The wiring is failsafe so when the
#1 RPI System is powered down the power circuit is live.
#2 On RPI Boot Up GPIO floats until the Main Routine configures the Relay Output with a GPIO.output(PinQ0, GPIO.HIGH)
#3 If a power reset is called then the output is switched using GPIO.output(PinQ0, GPIO.LOW) for 5 seconds and then new instruction GPIO.output(PinQ0, GPIO.HIGH).
#4 If the RPI crashes the current output status (usually GPIO.HIGH) is maintained.
#5 If the RPI Main Routine has a controlled stop the current output status (usually GPIO.HIGH) is maintained.
With the OPen PLC The intention/what's happening is as follows:
#1 RPI System is powered down the power circuit is live.
#2 On RPI Boot Up I will run the PLC automatically using the "Start OpenPLC in RUN mode" Function in OpenPLC. My RPI.cpp config file instructs (PinQ0, GPIO.HIGH).
#3 The power reset is now a PLC Rung as shown below. I have QX1 registers that are effectively my "Modbus Control Word" so in the example below the A7 Power Circuit is pulled down for 5 Seconds.

#4 No sure what happens when the PLC Crashes ??
#5 Controlled Stop using STOP PLC ??
So this leads me on to my problem. A controlled PLC STOP sends my relay outputs LOW hence cutting of all my power circuits (including the one with the Router & Server). Hopefully you can understand my problem now. Is there a way of maintaining the "Relay Outputs HIGH" or even in the "last current state" on a controlled stop ?
I have also noticed that on PLC Start there is a momentary LOW on the Relay Outputs. This may not be a problem but I'm guessing if the previous problem could be fixed this too could be addressed in the same hit !!
I have a quick fix which is don't push the "STOP PLC" button but this means as I am running PLC on Start Up that your very useful Monitoring Tool doesn't seem to be available.
Many Thanks in advance, Kevin