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 08:41] – 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 some applications A-axis is programmed as endless rotation. | + | For certain |
- | Program | + | |
- | {{mycnc:mycnc-1280m4-001.png}} | + | {{:mycnc:macros-m309-002.png}} |
- | To start new job A position | + | At the start of a new job which uses the A axis, the A position |
- | The best way to subtract a number of complete turns (360 degree), then move to " | + | |
- | This can be done through macro-programming. | + | This can be done through macro programming, using the M309 macro by default. 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 code provided below. |
- | We will add macro M335 to bring A axis to " | + | In the macro we will: |
+ | * Check if our A-position is positive (A-axis program position value is mapped | ||
+ | * Check the current coordinate and subtract 360 degree if current coordinate is more than 360 degree (more than 1 full turn) | ||
+ | * 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. | ||
+ | * After the coordinate is less than 360 degrees, this value will be stored as the current | ||
+ | * Move A-axis to " | ||
+ | * Add a similar branch for a situation in which we have a negative A-coordinate value. | ||
- | A-axis program position value is mapped to global variable #5044. In the macro we - | + | <code php M309> |
- | * Check if A-position is positive | + | G90G0Z[# |
- | * Add a code loop, | + | #10=#5044 (Store A coordinate |
- | * Test in the loop A-coordinate and subtract 360 degree if current coordinate is more than 360 degree | + | |
- | | + | |
- | * Move A-axis to " | + | |
- | * Add similar branch for negative A-coordinate | + | |
- | <code php M335>(Move to position A=0) | + | N10 |
- | #10=#5044 (Get position A) | + | IF [#10 LT 180] 20 (Go to line 20 if the loop is complete) |
+ | #10=#10-360 | ||
+ | JUMP 10 | ||
- | if [ #10 LT 0 ] 300 (Test If A-position | + | N20 |
- | (if positive) | + | IF [#10 GT -180] |
- | N100 | + | #10=#10+360 |
- | if [ #10 LT 180 ] 200 (Test if A-position higher than 180 degrees) | + | JUMP 20 |
- | #10 = #10 - 360 (Subtract a whole turn - 360 degree) | + | N50 |
- | JUMP 100 (Jump to begin of the Loop) | + | G91 G0 A [-1*#10] |
+ | G90 G10 L70 P0 A0 (resets machine coordinates) | ||
+ | G90 G10 L70 P#5220 A0 (resets program coordinates)</ | ||
- | N200 | + | Below is a video which illustrates the way the M309 macro functions: |
- | JUMP 400 | + | |
- | N300 | + | {{youtube> |
- | if [ #10 GT -180 ] 400 (Test if A-position lower than -180 degrees) | + | |
- | #10 = #10 + 360 (Add a whole turn - 360 degree) | + | |
- | JUMP 300 (Jump to begin of the Loop) | + | |
- | N400 | + | The main screen of the myCNC software already has a " |
- | G90 G10 L70 P# | + | |
- | G90 G0 A0 (rotate A axis to 0) | + | |
- | + | ||
- | </ | + | |
mycnc/move-a-to-0.txt · Last modified: 2019/11/18 11:37 by ivan