mycnc:move-a-to-0
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
mycnc:move-a-to-0 [2019/11/15 09:17] – ivan | mycnc:move-a-to-0 [2019/11/15 09:35] – ivan | ||
---|---|---|---|
Line 1: | Line 1: | ||
==== Rotate A axis to 0 position ==== | ==== Rotate A axis to 0 position ==== | ||
- | For certain applications, | + | For certain applications, |
{{: | {{: | ||
- | At the start of a new job which utilizes | + | At the start of a new job which uses the A axis, the A position will have to be rewound back to zero before starting a new run. Jogging (physical rotation) to " |
- | This can be done through macro programming, | + | This can be done through macro programming, |
- | A-axis program position value is mapped to the global variable # | + | In the macro we will: |
- | * Check if our A-position is positive | + | * Check if our A-position is positive |
- | * Add a code loop | + | |
* Check the current coordinate and subtract 360 degree if current coordinate is more than 360 degree (more than 1 full turn) | * Check the current coordinate and subtract 360 degree if current coordinate is more than 360 degree (more than 1 full turn) | ||
- | * Store the resulting | + | * Enter a code loop which will continuously check if the current remaining coordinate is more than 360 degrees, and repeat the previous step if it is. |
- | * Move A-axis to " | + | * After the coordinate is less than 360 degrees, this value will be stored |
+ | * Move A-axis to " | ||
* Add a similar branch for a situation in which we have a negative A-coordinate value. | * Add a similar branch for a situation in which we have a negative A-coordinate value. | ||
<code php M309> | <code php M309> | ||
- | G90G0Z[# | + | G90G0Z[# |
#10=#5044 (Store A coordinate in register #10) | #10=#5044 (Store A coordinate in register #10) | ||
N10 | N10 | ||
- | IF [#10 LT 180] 20 | + | IF [#10 LT 180] 20 (Go to line 20 if the loop is complete) |
#10=#10-360 | #10=#10-360 | ||
JUMP 10 | JUMP 10 | ||
N20 | N20 | ||
- | IF [#10 GT -180] 50 | + | IF [#10 GT -180] 50 (Go to line 50 if the loop is complete) |
#10=#10+360 | #10=#10+360 | ||
JUMP 20 | JUMP 20 | ||
Line 33: | Line 33: | ||
N50 | N50 | ||
G91 G0 A [-1*#10] | G91 G0 A [-1*#10] | ||
- | G90 G10 L70 P0 A0 | + | G90 G10 L70 P0 A0 (resets machine coordinates) |
- | G90 G10 L70 P#5220 A0</ | + | G90 G10 L70 P#5220 A0 (resets program coordinates)</ |
Below is a video which illustrates the way the M309 macro functions: | Below is a video which illustrates the way the M309 macro functions: | ||
Line 40: | Line 40: | ||
{{youtube> | {{youtube> | ||
- | 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: | + | The main screen of the myCNC software |
mycnc/move-a-to-0.txt · Last modified: 2019/11/18 11:37 by ivan