mycnc:gantry_alignment_macro_wizard
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:gantry_alignment_macro_wizard [2018/08/25 12:09] – skirillov | mycnc:gantry_alignment_macro_wizard [2018/08/26 10:45] – skirillov | ||
---|---|---|---|
Line 288: | Line 288: | ||
</ | </ | ||
+ | ==== Method 2+ ==== | ||
+ | |||
+ | What should be changed if Gantry alignment procedure needed for other axis (for example Y axis instead of X) | ||
+ | |||
+ | 1) Let's say Motor outputs #0 and #1 configured as Y. | ||
+ | |||
+ | {{mycnc: | ||
+ | |||
+ | 2) Procedure to connect both outputs to Y axis will look as | ||
+ | |||
+ | <code C M219.plc> | ||
+ | #include vars.h | ||
+ | main() | ||
+ | { | ||
+ | |||
+ | // | ||
+ | | ||
+ | // | ||
+ | // | ||
+ | // | ||
+ | // | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | |||
+ | 3) Need to change PLC procedure that looks after sensors to store Y position instead of X. | ||
+ | Change procedure name to M145.plc | ||
+ | |||
+ | |||
+ | <code C M145.plc> | ||
+ | #include pins.h | ||
+ | |||
+ | // Look after INPUT_GANTRY_S1 & INPUT_GANTRY_S2 input pins | ||
+ | // Position Y is stored in register #801 when sensor s1 triggered | ||
+ | // Position Y is stored in register #802 when sensor s2 triggered | ||
+ | // If both sensors triggered, then | ||
+ | // - Motion stopped | ||
+ | // - Position difference is calculated and stored into register #800 | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | do | ||
+ | { | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | if (mode1==0)// | ||
+ | { | ||
+ | if (s1!=s1_old) //if triggered now | ||
+ | { | ||
+ | | ||
+ | | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | | ||
+ | |||
+ | if (mode2==0)// | ||
+ | { | ||
+ | if (s2!=s2_old) //if triggered now | ||
+ | { | ||
+ | | ||
+ | | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | |||
+ | 4) Fix disable motor PLC procedure. Change procedure name to M211 (instead of M210) | ||
+ | |||
+ | <code C M211.plc> | ||
+ | #include vars.h | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | | ||
+ | |||
+ | | ||
+ | if (connect==0) | ||
+ | { | ||
+ | parameter=15; | ||
+ | }else | ||
+ | { | ||
+ | parameter=1+16; | ||
+ | }; | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | }; | ||
+ | </ | ||
+ | |||
+ | 5) change the alignment macro to use Y axis instead of X axis | ||
+ | |||
+ | <code awk M139> | ||
+ | M145 (# Set watching for GANTRY Sensors) | ||
+ | G91 G0 Y-1000 F500 (# Move toward Gantry Sensors) | ||
+ | |||
+ | ( There is message delivery time from PLC to CNC control software) | ||
+ | ( Need to wait some time till registers #800-802 will be updated ) | ||
+ | ( Add 0.5 seconds pause to get all the registers refreshed ) | ||
+ | |||
+ | G4 P0.5 (# Pause) | ||
+ | |||
+ | G10 L81 P810 Q800 (# Get offset in pulses) | ||
+ | G10 L192 P810 Q5531 (# Calculate offset in units/mm) | ||
+ | |||
+ | G10 L190 P810 Q805 (# Add adjustment offset) | ||
+ | |||
+ | M211 P0 (# OFF the second motor, the Only first motor is ON ) | ||
+ | |||
+ | G10 L190 P810 Q5021 (# Add current machine position) | ||
+ | G28.9 Y810 (# Move 1 motor to adjust) | ||
+ | |||
+ | M210 P1 (# ON the second motor, both motors are moved together) | ||
+ | |||
+ | </ | ||
mycnc/gantry_alignment_macro_wizard.txt · Last modified: 2020/01/31 14:24 by ivan