User Tools

Site Tools


mycnc:stop_end_program

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
mycnc:stop_end_program [2019/10/28 12:16] ivanmycnc:stop_end_program [2019/10/28 12:50] ivan
Line 64: Line 64:
 };</code> };</code>
  
-Additionally, whenever the player stops running G-code, the %%__HANDLER_GCODE_STOP%% Software PLC which is continuously running in the background will be activated. By default, the %%__HANDLER_GCODE_STOP%% simply consists of the following code:+As can be seen, while the M02.plc procedure will have some sort of lift control to prevent issues do to the working tool potentially coming into contact with the working material/surface, the OFF.plc command will simply stop all movement, clear all relevant ports to turn the system off, and end the program. Sometimes, when issues arise with the lift procedure, or with any of the processes described in the M02 procedure, it is advisable to click the Stop button twice in order to obtain a complete and total G-code run shutdown.  
 + 
 +Additionally, whenever the player stops running G-code, the %%__HANDLER_GCODE_STOP%% Software PLC which is continuously running in the background will be activated. This handler (along with the other Software PLC handlers) allows to monitor for some event, such as stopping a G-code run, and having some code be executed after the event has occurred. By default, the %%__HANDLER_GCODE_STOP%% simply consists of the following code
 + 
 +<code C __HANDLER_GCODE_STOP>main() 
 + { 
 +  exit(99); 
 + }; 
 +</code> 
 + 
 +Therefore, in a default configuration, this handler will simply activate, do nothing and then close. However, in situations where it is necessary to add a command which will activate whenever the G-code run has stopped, %%__HANDLER_GCODE_STOP%% can be used. For example, the code can be altered to look the following way if it is necessary, for example, to turn off the output port #3 when the run is stopped:
  
 <code C __HANDLER_GCODE_STOP>main() <code C __HANDLER_GCODE_STOP>main()
  {  {
 +  portclr(3);
   exit(99);   exit(99);
  };  };
 </code> </code>
  
-Therefore, in a default configuration, this handler will simply activatedo nothing and then closeHoweverin situations where it is necessary to add a command which will activate whenever the G-code run has stopped, %%__HANDLER_GCODE_STOP%% can be used+In non-default configurationsthere can be a number of outputs/inputs being set and cleared upon program stopOften, when issues arise with the ports being set and cleared seemingly at random upon program start/stop, it is an issue with code responsible for the port set / port clear being left over in the M02OFF, and %%__HANDLER_GCODE_STOP%% commands
mycnc/stop_end_program.txt · Last modified: 2024/02/21 13:54 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki