Universal Robots Forum

MODBUS output switch off when program not running


I send a control signal via MODBUS to an external device. This can be either high or low, depending on what I want to do in my program. So it does change state during normal operation. However, if the robot switches this output to TRUE during normal operation and then for some reason drops into an error state, the program stops, but the output remains at TRUE, which causes mayor problems. I need the MODBUS signal to be forced off if the program is NOT running, but can be either on or off during program operation (which is not the same as having a MODBUS signal active if the robot program runs, as in other threads on this forum).



The IO’s are writen with the program running, if the program stop for any reason, the outputs will not become FALSE by default. Unfortunably the UR programs doesn’t behave as a regular plc.


Ok, thanks. I was afraid so…

Would be a nice safety feature, though

You can set the modbus runstate dependency. There are options just like for digital outputs. You can set the signal to be low when not running. This will force the output to False anytime the program stops executing (includes pause, protective stop, etc)

I know you can set this with script and it may be possible from the pendant, we mainly use script so my Polyscope is a bit rusty.

Here is an excerpt from the script manual

modbus_set_runstate_dependent_choice(signal_name, runstate_choice)
Sets the output signal levels depending on the state of the program (running or stopped).


signal_name: A string identifying an output digital signal that in advance has been
runstate_choice: An integer:
0 = preserve program state,
1 = set low when a program is not
2 = set high when a program is not running,
3 = High when program is running and low when it is stopped.

Example command:
modbus_set_runstate_dependent_choice(“output2”, 3)
• Example Parameters:
– Signal name = output2
– Runstate dependent choice = 3 ! set low when a program is stopped and high when a program is running

Ah thank you!

This is what I was looking for.

I’m assuming that this only works with MODBUS digital outputs and not register outputs?

Along those lines has anyone come up with a good way to 0 a register output when the program is not running or if a fault occurs?

We’re using an IO breakout that uses input registers instead of single bit coils therefore I can’t use the Digital Output selection.