M1 Optional stop
At this point, the interpretation of the program code and the motion is interrupted if an optional stop is requested within the evaluation time period. The optional stop signal must be withdrawn for continued travel. To do so, the G-code import must be used to insert the call of a CallFunction with index 1 at the position of the M1 command. No path event is used. The time of the evaluation must be programmed in CallFunction 1 both via an evaluation condition and via the signal of the optional stop. CallFunction 1 of the optional stop command is called as soon as the program interpreter reaches the command with the program indicator.
The optional stop functionality can be imported as an IEC code example, and the example can be adjusted and used. See also chapter Call function for G-code.
The following G-code example shows the import of the M1 command:
G1 X0 Y0
G1 X350
M1
G1 Y350
G1 Y0
M30
The SRL program interpreter reads in new commands continuously (but at most up to the set lead-in). The set lead-in can be variable, just like the running time of the preceding commands, which mainly depends on the running duration of the preceding path segments. This may cause the signal that requests the optional stop to be interpreted too early or too late. Therefore, an evaluation condition must be specified that reflects the time at which the signal that requests the optional stop is to be interpreted. As such, the user can use information from the robot UI to determine that the signal is being interpreted if, for instance, a certain remaining number of path segments, a certain residual length, or a residual time period has been reached up to the target point. If the evaluation conditions are not met, the user code must return the value "FALSE" in the CallFunction. In this case, the program interpreter remains on the CallFunction command and continues to review the evaluation condition.
If the evaluation condition is met, the inverted signal for requesting the optional stop must be returned in CallFunction 1. The "TRUE" value of this signal means that the optional stop was requested. The "FALSE" value means that the application is being enabled for continued travel.
In the following example, the number of remaining path segments is selected as a condition for the evaluation time period. Only when the motion being carried out has arrived at the last path segment is the signal of the optional stop evaluated. Beforehand, the status of the signal is ignored. In this case, the SRL-BOOL variable with Index 82 is used as a signal source for requesting the optional stop. However, other conditions or inputs (digital input / output) can also be used at this point.
Alternatively, the following conditions illustrated as examples can also be used to define the evaluation time period:
- If a certain distance for reaching the target point is not reached:
Interface_MyRobot.Prg.OUT.lrRemainingDistance > 100.0
- If a certain time period for reaching the target point does not elapse:
Interface_MyRobot.Prg.OUT.lrRemainingTime > 100.0
- Via an SRL variable that was set via a condition in the SRL program or a PathEvent:
NOT Interface_MyRobot.PrgVar.axBoolValues[81]