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 revision Previous revision
mycnc:stop_end_program [2019/10/28 13:01]
ivan
mycnc:stop_end_program [2019/10/28 13:48] (current)
ivan
Line 9: Line 9:
   * %%__HANDLER_GCODE_STOP%% (Settings > Config > PLC > Software PLC)    * %%__HANDLER_GCODE_STOP%% (Settings > Config > PLC > Software PLC) 
  
-The actions taken upon pressing the button differ depending on the sequence ​of events. If pressing ONCE, the M02.plc procedure is started (below is the M02.plc for the Plasma profile X1366P):+The exact actions taken upon pressing the Stop button differ depending on the number ​of times the button is pressed. If pressing ONCE, the M02.plc procedure is started (below is the default ​M02.plc ​code for the Plasma profile X1366P):
  
 <code C M02.plc> <code C M02.plc>
Line 39: Line 39:
 };</​code>​ };</​code>​
  
-If the Stop button is pressed TWICE, the OFF.plc procedure will be utilized:+{{:​mycnc:​stop-end-003-m02.png}} 
 + 
 +If the Stop button is pressed TWICE, the OFF.plc procedure will be used. Below is the default code for the OFF.plc procedure for the X1366P profile (note that the procedures will be different for other profiles and different user cases):
  
 <code C OFF.plc>#​include pins.h <code C OFF.plc>#​include pins.h
Line 64: Line 66:
 };</​code>​ };</​code>​
  
-The two separate commands allow for a variety of stopping configurations. M02.plc procedure ​can often be set to have some sort of lift control to prevent issues ​do to the working tool potentially coming into contact with the working material/​surface,​ while the OFF.plc might be set to 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 (if that is the way that the codes have been set up). Alternatively,​ on some profiles the OFF.plc will not perform any additional actions as compared to M02.plc, or vice versa - the configuration depends almost entirely on the particular needs of the user and the machine+{{:​mycnc:​stop-end-004-off.png}} 
 + 
 +The two separate commands allow for a variety of stopping configurations. M02.plc procedure ​will often be set to have some sort of lift control to prevent issues ​due to the working tool potentially coming into contact with the working material/​surface,​ while the OFF.plc might be set to clear all relevant ports to turn the system off, and end the program ​without any additional movement. Alternatively,​ on some profiles the OFF.plc will not perform any additional actions as compared to M02.plc, or vice versa - the configuration depends almost entirely on the particular needs of the user and the machine  
 + 
 +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 (if that is the way that the codes have been set up). 
  
 Additionally,​ whenever the myCNC 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: Additionally,​ whenever the myCNC 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:
Line 74: Line 80:
 </​code>​ </​code>​
  
-Therefore, in 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 altered. For example, the code can be changed to look the following way if it is necessary, for example, to turn off the output port #3 when the run is stopped:+{{:​mycnc:​stop-end-005-handler.png}} 
 + 
 +As can be seen from the code above code, in its default configuration ​the handler will simply activate and then close, not performing any additional actions. 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 altered. For example, the code can be changed to look the following way if it is necessary, for example, to turn off the output port #3 whenever ​the run is stopped:
  
 <code C __HANDLER_GCODE_STOP>​main() <code C __HANDLER_GCODE_STOP>​main()
Line 83: Line 91:
 </​code>​ </​code>​
  
-In non-default configurations,​ there can be a number of outputs/​inputs being set and cleared upon program stop. Often, when issues arise with the ports being set and cleared ​seemingly at random ​upon program start/stop, it is an issue with port set / port clear code being left over in the M02, OFF, and %%__HANDLER_GCODE_STOP%% commands. ​+In non-default configurations,​ there can be a number of outputs/​inputs being set and cleared upon program stop. Often, when issues arise with ports being set and cleared upon program start/stop, it is an issue with port set / port clear code being left over in the M02, OFF, and %%__HANDLER_GCODE_STOP%% commands. ​Therefore, it is advisable to begin diagnostics with looking for portset/​portclr codes in these commands to see if the behaviour has been previously defined there.  
 + 
mycnc/stop_end_program.txt · Last modified: 2019/10/28 13:48 by ivan