Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: KipKirol on July 11, 2018, 05:25:25 PM

Title: Using a macro to "ref all home"
Post by: KipKirol on July 11, 2018, 05:25:25 PM
I have created a macro to "ref all home"    A quick and easy safety step I am adding since our machine has lost position in the Y and Z axis, causing catastrophic table damage (working with a 15" cutter head here)

I am using M12, and the macro rads as follows:

DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

DoOEMButton(133)
DoOEMButton(134)
DoOEMButton(135)


The above is just a copy of the "ref all home" button script.   We only use the Y and Z axis so the extra buttons are not necessary but dont seem to have an affect.

When I go to MDI and type in M12 the machine responds as if I have pushed "ref all home" exactly as I had intended.

When I add the M12 into a program and load into Mach3, the controller stops "generating toolpath" when it arrives at the M12 line and just waits for me to click cancel.   If I run the program, the machine runs through the header to the M12, does the homing move, and starts at the top of the program.   I think if I left it, it would just repeat this forever.    Here is what my header looks like:

G21                           
G90                           
G53         Z   0               
T1 M6                           
G0 G90 G54   Y   -79                     
M12                           
G0   Y   -79                     
                     S   3250   M3
G43 H1         Z   15               
G1                F   250   



Any ideas how I can make this work?   

 
Title: Re: Using a macro to "ref all home"
Post by: ger21 on July 11, 2018, 07:44:04 PM
Try using G28 instead.
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on July 11, 2018, 08:09:01 PM
When I use a G28 it moves the axii to their home position but does not touch off the limit switches.   So if the machine has lost position a G28 will not bring it to the correct home position.
Title: Re: Using a macro to "ref all home"
Post by: ger21 on July 12, 2018, 09:10:28 AM
How about G28.1?
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on July 12, 2018, 10:51:25 AM
Here is a header with G28.1 for the Y and Z      I tested G28.1Y0 and G28.1 Z15 in MDI and standing alone they both work fine.     

However when running the code, the machine gets stuck on the G28.1 Z15 line.     It rapids down to 15 and slowly touches off the limit switch twice as if it were homing then it rapids to 15 and just does this repeatedly.   The Zero Z button never goes from red to green (it was green/homed when starting the file)

When I delete the G28.1 Z15 line it then goes to the G28.1 Y0 line and acts similarly, never moving on on the program.



G21                           
G90                           
G53         Z   0               
T1 M6                           
G0 G90 G54   Y   -79                     
G28.1         Z   15               
G28.1   Y   0                     
G0   Y   -79                     
                     S   3250   M3
G43 H1         Z   15               
G1                F   250   
Title: Re: Using a macro to "ref all home"
Post by: Graham Waterworth on July 15, 2018, 01:26:42 PM
On my machines I do it this way :-

%
G21 G40 G49 G80
G91 G28.1 Y0 Z0

N1(TOOL 1)
T1 M6                           
G54 G00 G90 Y-79                                   
S3250 M3
G43 H1 Z15               
G1 F250   
Etc....
%
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on July 16, 2018, 11:51:13 AM
I think I am missing something simple here - Graham I tried using part of your code in my header and I got the same result that I described above - the machine touches off the Y and Z limit switches and rewinds the program and does this indefinitely.   Am I missing a command to to continue or something like that?         Here is what I am working with - (the program wont advance passed line 6 (G91 G28.1 Y0 Z0) and instead rewinds to the beginning of the program

G21                           
G90                           
G53         Z   0               
G0 G54   Y   -79                     
G21 G40 G49 G80
G91 G28.1 Y0 Z0                  
G90 G0   Y   -79                     
T1 M6                     S   3250   M3
G43 H1         Z   15               
G1                F   250   
Title: Re: Using a macro to "ref all home"
Post by: ger21 on July 16, 2018, 12:18:42 PM
What version of Mach3?

Are you using the parallel port, or a motion controller?

It could be a Mach3 bug, or that your motion controller does not properly support G28.1.
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on July 16, 2018, 01:12:10 PM
Mach 3 Version 3.043.066

Using a USB to this card -
Mach3 XHC MK4-IV   

Paid for the software and controller with purchase of our machine
Title: Re: Using a macro to "ref all home"
Post by: ger21 on July 16, 2018, 01:57:41 PM
I would try version 3.043.062, as .066 is known to be buggy.

And the chinese motion controller may be the issue, as most if not all chinese controllers have some issues with Mach3 functions.
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on July 16, 2018, 02:07:16 PM
Interesting, OK.     DO you know where I can download version .042?

If the problem is in fact the card, what is a reputable 4+ axis controller card?   (using 2 axii now but about to add 2 more) hence why I need 4+
Title: Re: Using a macro to "ref all home"
Post by: ger21 on July 16, 2018, 02:36:17 PM
The current version on the website is 3.043.062.

Any controller not made in China should work, but I'd ask if it supports G28.1 before purchasing.
Title: Re: Using a macro to "ref all home"
Post by: Graham Waterworth on July 20, 2018, 08:31:42 PM
What happens if you just run this bit of code no extra bits or edits.

%
G21 G40 G49 G80
G91 G28.1 Y0 Z0
M30
%
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on July 24, 2018, 11:38:10 AM
Graham - same thing.   This machine gets caught in a loop touching off the Y and Z switches
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 14, 2018, 03:06:18 PM
I downloaded the version of Mach3 from Artsoft's website (v3.043.062) rolling back from the version which came with the machine (v3.043.066) and things still behave the same.

All the code act the same in both versions -ie repeating forever when ran as a gcode file and working as predicted when typed into MDI.

Do you still think this could be the control card?  Is there anything else I can try before trying a different card?
Title: Re: Using a macro to "ref all home"
Post by: TPS on August 15, 2018, 04:44:44 AM
have you tryed to run your M12 Version with

Config -> General Config -> Ignore M calls while loading    enabled?
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 15, 2018, 11:36:06 AM
I just tried "Config -> General Config -> Ignore M calls while loading    enabled?"  and restarted my software and tried again.   Still get the same results, the machine gets to M12 and rewinds to the top of program.. over and over again.

G21                           
G90                           
G53         Z   0               
G0 G54   Y   -79                     
M12                  
G0   Y   -79                     
T1 M6                     S   3250   M3
G43 H1         Z   15               
G1                F   250         
Title: Re: Using a macro to "ref all home"
Post by: TPS on August 15, 2018, 01:18:24 PM
ok tested this here

code M12 macro
Code: [Select]
DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

DoOEMButton(133)
DoOEMButton(134)
DoOEMButton(135)

gcode file:
Code: [Select]
G21                           
G90                           
G53 Z0               
G0 G54 Y-79                     
M12                 
G0 Y-79                     
T1 M6 S3250 M3
G43 H1 Z15               
G1 F250

without any Problem, maybe somebody else can do the test as well, to doublecheck.
   
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 15, 2018, 01:27:28 PM
Thanks for checking!!          What control card you using?       
Title: Re: Using a macro to "ref all home"
Post by: TPS on August 16, 2018, 02:32:04 AM
i tested on my testsystem witch is PP, no motioncontroler.
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 16, 2018, 10:27:58 AM
I see.
Title: Re: Using a macro to "ref all home"
Post by: TPS on August 16, 2018, 03:09:07 PM
witch motioncontroler areyou using?
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 16, 2018, 05:50:10 PM
Mach3 XHC MK4-IV  
Title: Re: Using a macro to "ref all home"
Post by: TPS on August 17, 2018, 01:42:43 AM
ok, but anyhow it is courios, that you can run the M12 via MDI without any Problem,
and by enabling the Ignore M calls while loading it should not go into the macro.


i have two further ideas to test (without any idea of the real reason):

- rename the M12 to M312 for example

- put additional code into M12

If Not() IsLoading() Then

   ..your M12 code here

End If

Thomas
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 21, 2018, 07:03:09 PM
I copied M12 and renamed to M312... same results

I modified the M312/M12 file, it now reads as:

If Not() IsLoading() Then

DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

DoOEMButton(133)
DoOEMButton(134)
DoOEMButton(135)

End If





When I type M312 into MDI, I get this error - Scripter Compile Error. In:M312.m1s
Title: Re: Using a macro to "ref all home"
Post by: joeaverage on August 21, 2018, 07:36:17 PM
Hi,
I don't know VB but:

Quote
Not() IsLoading()
Doesn't look right to me.

Try:
 Not(IsLoading())

Craig
Title: Re: Using a macro to "ref all home"
Post by: ger21 on August 21, 2018, 07:40:40 PM
Try :

If Not IsLoading() Then
...
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 21, 2018, 07:48:55 PM
I rewrote the Macro with both Not(IsLoading()) and Not IsLoading(), Not IsLoading() returned the same error and Not(IsLoading()) ran the macro in MDI OK and caused the same loop when running as a part of my header
Title: Re: Using a macro to "ref all home"
Post by: joeaverage on August 21, 2018, 08:04:05 PM
Hi,
Gerry is way more experienced in VB than I, if he suggests:
Not IsLoading() that is the correct syntax.

Craig
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 21, 2018, 08:26:02 PM
The code runs fine like this in MDI
If Not(IsLoading()) Then

DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

DoOEMButton(133)
DoOEMButton(134)
DoOEMButton(135)

End If





Code returns the error   Scripter Compile Error. In:M312.m1s     when written like this:

If NotIsLoading() Then

DoButton( 24 )
DoButton( 23 )
DoButton( 22 )
DoButton( 25 )

DoOEMButton(133)
DoOEMButton(134)
DoOEMButton(135)

End If
Title: Re: Using a macro to "ref all home"
Post by: TPS on August 22, 2018, 02:55:41 AM
sorry for the wrong Syntax.

so it Looks like you Controller is making a rewind of the code.

you have tryed two seperate methodes for homing (DoButton() and G28.1) with the same result.


i have seen in the Manual of your Motion Controller, that you can select different homing mode's.
have you "played" with this configurastion ?
Title: Re: Using a macro to "ref all home"
Post by: ger21 on August 22, 2018, 06:37:18 AM
Hi,
Gerry is way more experienced in VB than I, if he suggests:
Not IsLoading() that is the correct syntax.

Craig

There goes any credibility that I had.....
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 22, 2018, 11:12:44 AM
sorry for the wrong Syntax.

so it Looks like you Controller is making a rewind of the code.

you have tryed two seperate methodes for homing (DoButton() and G28.1) with the same result.


i have seen in the Manual of your Motion Controller, that you can select different homing mode's.
have you "played" with this configurastion ?

I am not quite sure what you mean by first part - are you suggesting putting G28.1 in the Macro code?

I have not selected different homing modes, I didnt think that would affect this... but at this point, why not try everything?    BTW are you talking about the options listed on page 37?  http://www.cdxhctech.com/upload/201712/20171229133856963.pdf
Title: Re: Using a macro to "ref all home"
Post by: TPS on August 22, 2018, 03:01:47 PM
i am talking about this Options:

No Homing:
Single Stage:
Dual Stage:
Home Switches

on page 34
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 22, 2018, 03:17:11 PM
i am talking about this Options:

No Homing:
Single Stage:
Dual Stage:
Home Switches

on page 34

I have not tried those options.   I could I suppose as I am willing to try anything at this point.
Title: Re: Using a macro to "ref all home"
Post by: KipKirol on August 29, 2018, 02:21:49 PM
I've been very busy lately but figured I would come over and update you all.

It turns out the machine seller supplied us with an illegitimate copy of Mach3.    It is also presumed that the XML machine profile supplied by the seller may not be working the way it is supposed to.     If the XML file is in fact "not right" then that would explain why the same issues persisted in the rolled back version I downloaded from the website.

We own a legitimate license now and my next move will be to build a new machine profile from scratch.    Realistically I wont get to this for the next week or two as both our machines are busy keeping up with production.

Thank you all for the help and suggestions thus far.