mycnc:macro_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
mycnc:macro_examples [2017/06/14 17:24] – skirillov | mycnc:macro_examples [2017/06/14 17:35] – skirillov | ||
---|---|---|---|
Line 13: | Line 13: | ||
We will add macro M335 to bring A axis to " | We will add macro M335 to bring A axis to " | ||
- | A-axis program position value is mapped to global variable #5044. | + | A-axis program position value is mapped to global variable # |
- | We will arrange | + | * Check if A-position is positive |
+ | * Add a code loop, | ||
+ | * Test in the loop A-coordinate and subtract | ||
+ | * Store result | ||
+ | * Move A-axis to " | ||
+ | * Add similar branch for negative A-coordinate value. | ||
<code php M335> | <code php M335> | ||
#10=#5044 (Get position A) | #10=#5044 (Get position A) | ||
- | if [ #10 LT 0 ] 300 | + | if [ #10 LT 0 ] 300 (Test If A-position is negative) |
+ | (if positive) | ||
N100 | N100 | ||
- | if [ #10 LT 180 ] 200 | + | if [ #10 LT 180 ] 200 (Test if A-position higher than 180 degrees) |
- | #10 = #10 - 360 | + | #10 = #10 - 360 (Subtract a whole turn - 360 degree) |
- | JUMP 100 | + | JUMP 100 (Jump to begin of the Loop) |
N200 | N200 | ||
Line 31: | Line 36: | ||
N300 | N300 | ||
- | if [ #10 GT -180 ] 400 | + | if [ #10 GT -180 ] 400 (Test if A-position lower than -180 degrees) |
- | #10 = #10 + 360 | + | #10 = #10 + 360 (Add a whole turn - 360 degree) |
- | JUMP 300 | + | JUMP 300 (Jump to begin of the Loop) |
N400 | N400 | ||
G90 G10 L70 P#5220 A#10 (store #10 value as A-axis program position) | G90 G10 L70 P#5220 A#10 (store #10 value as A-axis program position) | ||
- | G90 G0 A0 | + | G90 G0 A0 (rotate A axis to 0) |
+ | </ | ||
- | </ | + | [[Add move A to 0 button]] |
mycnc/macro_examples.txt · Last modified: 2022/03/29 15:54 by ivan