Hello Guest it is March 28, 2024, 06:02:38 PM

Author Topic: REF ALL HOME Code  (Read 8366 times)

0 Members and 1 Guest are viewing this topic.

REF ALL HOME Code
« on: October 22, 2013, 07:09:18 AM »
I have two questions
1. I would like to have a "G" or "M" code to make the CNC move to and operate the REF ALL HOME button. I have limit switches and the REF ALL HOME works great. It finds the switch and then backs off approximately .050 and sets zero, I like it. I would like the "G" code to do the same.
2. I Would like to use a "G" code to set an offset in my program for the X,Y and Z in case my CNC moves. Example - start location is 0,0,0. System moved by .020 in all axis. "G" code to shift all X,Y and Z axis by the .020. This way I don't have to re-program all of the X,YZ coordinates, which are about 30.

Allen
 :)

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: REF ALL HOME Code
« Reply #1 on: October 22, 2013, 10:29:18 AM »
Ref all from code is easy enough. All you would do is open Notepad and type in the code you wish then save to your macro folder with a name such as m123.m1s
When you now call m123 from your code it will execute the script in that macro.


Not really sure what you are meaning by question 2.
 You can set up work offsets to anything you want, by simply pressing the zero at the side of each DRO you are setting up a work offset, usually G54 but that will depend on whether you have called one of the other 253 offsets available.
Hood

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: REF ALL HOME Code
« Reply #2 on: October 22, 2013, 01:17:03 PM »
From Gcode use

G28.1

It will send all the axis back to their home switch.

As to work offsets you can use

G52 or G92 or L10 or G55,G566,etc. They are all covered in the Mach3 manual OR in Smids programing manual.

Give them a read.

(;-) TP
Re: REF ALL HOME Code
« Reply #3 on: October 22, 2013, 05:18:16 PM »
Will the G28.1 code work just like the "REF ALL HOME" button?
Does the G28.1 code move slowly to the find the switch and then back off until the switch circuit is closed?

Allen

Offline Hood

*
  •  25,835 25,835
  • Carnoustie, Scotland
    • View Profile
Re: REF ALL HOME Code
« Reply #4 on: October 23, 2013, 03:17:21 AM »
Yes and no.
G28.1 will need to be used 3 times if you want separate axis movement such as Z first the X then Y.
Also you will need to call a position to initially move to and then from that position it will slow to the speed you have set in Homing and Limits. So as an example
G28.1 Z2  ' This will home the Z, it will first move at rapid speed to Z2( in offset coords) and then the feedrate will be changed to what you have set in homing and limits and it will do the Z homing routine.

So if you wanted to do as per the RefAll button you would have to do something like
G28.1 Z2
G28.1 Y2
G28.1 X2

If you did
g28.1 x2 y2 z2
 then all axis would move at the same time to the X, Y, Z 2 position and then X would home, then Y then Z.

If however you had written the macro as above and had exactl;y the same as you had in the RefAll button then it would do as the RefAll button does when you commanded
m123


Hood