Hi,
I recently created a script using the Expr.txt file, in order to check whether input 2 is activated before starting a program and to display an error message accordingly. I use an Mk3/4 controller by the way. Here is the short line of code:
if (_hw_input_num|2==1 && _hw_isprog==1,exec(cmd('Machine.Emergency_Stop'),m sg("Emergency Stop: the security enclosure has been opened during a program. Please close it and start the program again.")))
To give a bit of context, this input is connected to a reed switch, which is placed on the door of an enclosure surrounding my machine. If the door is open, input 2 is high and it is impossible to start a G-code.
Everything works very nicely, but I started to notice weird behaviors from the controller when the door is open (input2=1). For instance, the homing procedure doesn't work correctly, but it starts working perfectly again if I close the door. If I manually jog an axis and I suddenly open the door while doing so, the motion stops or gets jerky if I open/close several times.
Then I started to wonder if the issue also existed with outputs, and found the same problem. Even if nothing is connected to any output, turning on and off the spindle icon while jogging an axis will make it stop or get jerky as well.
Is there any explanation of how the firmware/controller works to help me understand this? Or is it something else that I'm missing?
Thanks for the help!