Hello Guest it is May 24, 2019, 05:42:44 AM

Author Topic: Limit/Homin switches  (Read 5394 times)

0 Members and 1 Guest are viewing this topic.

Limit/Homin switches
« on: May 16, 2008, 10:03:03 AM »
First time poster and newbie to Mach 3. 

I have a homing/limit switch on 3 different axis, wired in series, all hooked to the same port and pin.  After each switch is tripped in the Reference All Home routine I want the machine to move to some offsets that will become my regular working 0,0.  I understand this is possible to do via the homing/limit function.  I have placed the offset dimesnions in the G28 boxes in the lower left of the Homing/Limit screen.  The Auto Zero function is turned on for all 3 axis. but when the Ref. All Home button is pushed the machine goes to the different home postions for each axis, but does not move to the designated offsets.  What am I doing wrong?

Offline Hood

*
  •  25,816 25,816
  • Carnoustie, Scotland
    • View Profile
Re: Limit/Homin switches
« Reply #1 on: May 16, 2008, 10:30:52 AM »
If you either type G28  into the MDI line and press Enter or  have it at the start of your code the machine will go to that position.
 Alternatively you could go to the Operator menu then down to Edit VB Buttons and then the Ref All button should be flashing, click on it and in the Editor that pops up put the following on the last line and save it.

Code "G28"

Next time you press the Ref All your machine should ref all axis and then move to the G28 position.
Hood

Offline poppabear

*
  • *
  •  2,231 2,231
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Limit/Homin switches
« Reply #2 on: May 16, 2008, 11:10:34 AM »
Automatic G28 after, initial Reset and homing:

If you want this to be an automatic function you can make a Macro pump, and a custom Macro as well see below.

Instructions for use:

1). Goto Home/limits and set where you want your G28 position to be (note, this will also activate your "Safe Z" if you have it ticked and set.
2). In Mach goto: Operator>VB scripter and click on it.
3). Copy and past the code below for "MacroPump.m1s" into the window, goto: File>SaveAs in that window, and name it: "MacroPump.m1s", NOTE: make sure the directory you are saving it to IS the Profile you are running under the Macros folder. I.e. if you are running standard MachMill then the path would be Mach3/Macros/Mach3Mill.
4). Then delete the code from the window, then copy and paste in the: "M900.m1s" do a "saveas" like you did above but call it M900.
5). then close the VB scripter window.
6). goto: Config>General and tick the button called "Run Macropump".
7). Close Mach3, and then reopen it.
8). when it comes back up, hit Reset, then your Ref-All button, your machine will home itself, then it will move to your G28 offset.

NOTE: if for any reason you hit a Reset after the intital G28, Mach will not "UnRef" the homes. Thus when you come back out of a reset it will not automatically re-G28 since the Refed axis LED are still referenced. If you wanted it to redo the G28 again without closing Mach3, you would have to put a "DeRef axis" in the Reset button, OR, the Macropump.

Here is the Macropump code:

'**********MacroPump.m1s

'Function: "Home Offset after Ref".
'the below makes sure that all three axis x, y, z are refed.
'the counter makes sure this code only runs once per reset.

RefOnce = GetUSERDRO(2000)  'counter DRO

If NOT(GetOEMLED(807)) and Not(GetOEMLED(808)) and Not(GetOEMLED(809)) and RefOnce = 0 Then
Code "m900"   'sends machine to your offsets macro
SetUserDRO(2000,1) 'sets counter to 1 so this code drops out.
End If

If GetOEMLED(800) Then
SetUserDRO(2000,0) 'sets counter to 0 when reset.
End If

'*******here is the M900.m1s code:

'm900.m1s

Code "G4 P1"
While IsMoving()
WEnd
Code "G28"
While IsMoving()
WEnd


'Enjoy,
'Scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: Limit/Homin switches
« Reply #3 on: May 16, 2008, 11:34:31 AM »
Thanks guys.  Looks like the problem has been fixed by simply editing the script for the Ref All button to add  Code   "G28".  The one fluke that I wasn't expecting was that the X axis moved about 25" and then came back to its intended spot.  The 2nd time it only moved about 3" and then came back to its intended spot. 
Thanks again for all the help.

Gary
Re: Limit/Homin switches
« Reply #4 on: May 30, 2008, 10:59:27 AM »
Hello Again,

I have a general questions about interface between machine and Mach3. Is it possible to start a Mach3 program using the start switch on the machine I am controlling? Maybe I am missing something very obvious??? Currently I have to click the " Cycle Start" or Alt R to start Mach3, then when Mach3 hits the M3 or M4 command I am allowed to hit the power switch on machine. I am using this equipment in production and the operator has to do this this 300 to 800 times a day depending on our production requirements. Pressing one button sure would make things much easier. It has to be stopped and started to load another part.

Thanks.

B.E.N.

Offline Hood

*
  •  25,816 25,816
  • Carnoustie, Scotland
    • View Profile
Re: Limit/Homin switches
« Reply #5 on: May 30, 2008, 03:05:28 PM »
You can set up a physical switch to do most things as long as you have the Inputs to do so. If you want a button for cycle start then you can set it up as an OEM Trigger, enter the pin and port details for that trigger then finally go the the Config then Hotkeys menu and enter the OEM code for the trigger you set up. You can do the same for FeedHold, Stop or whatever button you want.
Hood
Re: Limit/Homin switches
« Reply #6 on: June 02, 2008, 09:34:08 AM »
Hood,

Thanks for the reply. I did find the xls sheet of all the OEM codes. Looking thru them I see start is code 1000. So would have to assume I load 1000 in the OEM code table under hotkeys and wire in an input to the parallel port and the program will start when I push the machine start.

Appreciate the info.

Kerry

Offline Hood

*
  •  25,816 25,816
  • Carnoustie, Scotland
    • View Profile
Re: Limit/Homin switches
« Reply #7 on: June 02, 2008, 10:26:46 AM »
Yes thats right, hotkey menu and set the OEM Trigger 1 to 1000, then OEM Trigger 1 in ports and pins~Inputs set to the pin you have your switch connected to and you are all set. I have quite a few set up on my Lathe, Start, FeedHold, FRO+, FRO-, FRO Reset, MPG X axis select, Z Axis select, MPG Step mode, MPG Velocity mode and a few others.

Hood