Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 01:27:59 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Automatic G28 after, initial Reset and homing for your use
Pages: 1   Go Down
Print
Author Topic: Automatic G28 after, initial Reset and homing for your use  (Read 1569 times)
0 Members and 1 Guest are viewing this topic.
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« on: May 16, 2008, 10:12:32 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.
Cool. 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
Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Azrael
Active Member

Offline Offline

Posts: 44



View Profile WWW
« Reply #1 on: December 25, 2009, 09:30:45 AM »

Is it possible to change a little bit this macro so it perform an automatic "reference all axis" after initial reset, and if any of axes is unreferenced? I have tried some changes, but couldn't manage it to works :-(

Cheers
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #2 on: December 29, 2009, 01:54:53 PM »

sure in Screen Designer, open the RESET button, put the VB code for reference axis (how every many you need).
Note this will ref your axis each time you push the Reset button.

DoButton( 24 ) 'ref z
DoButton( 23 ) 'ref y
DoButton( 22 ) 'ref x
DoButton( 25 ) 'ref a
DoButton( 26 ) 'ref b
DoButton( 27 ) 'ref c


Logged

Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!