User Tools

Site Tools


mycnc:move-a-to-0

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
mycnc:move-a-to-0 [2017/09/04 12:06] – created skirillovmycnc:move-a-to-0 [2019/11/15 09:17] ivan
Line 1: Line 1:
 ==== Rotate A axis to 0 position ==== ==== Rotate A axis to 0 position ====
  
-For some applications A-axis is programmed as endless rotation. +For certain applications, the A axis is programmed as endlessly rotatingTherefore, the **A** position (in both machine and program coordinates) may be specified as several thousand degrees after the G-code has completed runningAn example of such behaviour can be seen in the screenshot below:
-Program position of A may come to many hyndreds degree after G-code finishedSee screenshot example below -+
  
-{{mycnc:mycnc-1280m4-001.png}}+{{:mycnc:macros-m309-002.png}}
  
-To start new job A position should be roll back to about "0" position. Jogging to "0" may take a long time. In some cases it's possible just reset A position, but A axis orientation will be lost. +At the start of a new job which utilizes the A axis, the A position has to be equal to zero, therefore the axis will have to rotate to zero before starting a new job. Jogging (physical rotation) to "0" may take a long time (can be hundreds of complete turn to run). In some cases it's possible to simply reset the axis position to zero at the end of the job runindicating that whatever point the A axis has stopped at will be the next zero, thus saving time on the rewind process. This, however, runs into the problem of a lost orientation for the A axis, which may then require homingTherefore, the best way to still keep the A-axis orientation, but still save time is to reset all complete rotation turns of the A axis (360 degree), and then physically jog to the A-axis "0", retaining the previous orientation.
-The best way to substract from current A-coordinates a whole number of turns (360 degree), then move to "0".+
  
-This can be done through macro-programming.+This can be done through macro programming, using the M309 macro. All recent myCNC profiles should have the M309 macro in their Macro List. If your profile does not have the M309 macro, it is possible to add it using the macro code provided below
  
-We will add macro M335 to bring A axis to "0", then add a button to run the macro. +A-axis program position value is mapped to the global variable #5044. In the macro we will: 
- +  * Check if our A-position is positive 
-A-axis program position value is mapped to global variable #5044. In the macro we  +  * Add a code loop 
-  * Check if A-position is positive +  * Check the current coordinate and subtract 360 degree if current coordinate is more than 360 degree (more than 1 full turn)  
-  * Add a code loop +  * Store the resulting value as the current A-axis position 
-  * Test in the loop A-coordinate and subtract 360 degree if current coordinate is more than 360 degree (more than 1 turn) +
-  * Store result value as current A-axis position and then +
   * Move A-axis to "0".   * Move A-axis to "0".
-  * Add similar branch for negative A-coordinate value.+  * Add similar branch for a situation in which we have a negative A-coordinate value.
  
-<code php M335>(Move to position A=0) +<code php M309> 
-#10=#5044 (Get position A)+G90G0Z[#7020] 
 +#10=#5044 (Store coordinate in register #10)
  
-if [ #10 LT 300 (Test If A-position is negative) +N10 
-(if positive) +IF [#10 LT 180 20 
-N100 +#10=#10-360 
-if [ #10 LT 180 ] 200 (Test if A-position higher than 180 degrees)+JUMP 10
  
-#10 = #10 - 360 (Subtract a whole turn - 360 degree) +N20 
-JUMP 100 (Jump to begin of the Loop)+IF [#10 GT -180]  50 
 +#10=#10+360 
 +JUMP 20
  
-N200 +N50 
-JUMP 400+G91 G0 A [-1*#10] 
 +G90 G10 L70 P0 A0 
 +G90 G10 L70 P#5220 A0</code>
  
-N300 +Below is video which illustrates the way the M309 macro functions:
-if [ #10 GT -180 ] 400 (Test if A-position lower than -180 degrees) +
-#10 = #10 + 360 (Add whole turn - 360 degree) +
-JUMP 300 (Jump to begin of the Loop)+
  
-N400 +{{youtube>-gK4bl4JZ3Q?large}}
-G90 G10 L70 P#5220 A#10 (store #10 value as A-axis program position) +
-G90 G0 A0 (rotate A axis to 0) +
-</code>+
  
-[[mycnc:mycnc_setup#add_move_a_to_0_button_to_run_macro_with_confirmation|Add "move A to 0" button]]+The main screen of the myCNC software has a "Move A to 0" button by default, as shown in the screenshot at the top of this page. The way to add such a button to the screen is described here: [[mycnc-screen:1280_series_screen_configuration_examples#add_move_a_to_0_button_to_run_macro_with_confirmation|Add "Move A to 0" button example]], and more information on adding buttons and on-screen elements can be found in the [[mycnc:mycnc_screen_configuration|MyCNC Screen Configuration]] manual.
  
mycnc/move-a-to-0.txt · Last modified: 2019/11/18 11:37 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki