Hello Guest it is March 29, 2024, 09:40:20 AM

Author Topic: I can't get the G95 feedrate to work properly in Macro  (Read 7204 times)

0 Members and 1 Guest are viewing this topic.

I can't get the G95 feedrate to work properly in Macro
« on: November 02, 2011, 11:38:56 AM »
I took some snipits from the forum here and was trying to use a macro for tapping but it's not working.
When done in a sub, it works fine, when in a macro, the feed barely moves.

Subroutine that works:

G20 (Units: Inches)
G40 G90

(Set Editable Parameters)
#1=0.36         (Set Thread Depth)
#2=16.0         (Set Thread Pitch in Turns per Inch)
#3=400         (Set RPM)
#4=0.1      (Set Rapid Height)

(Internal Parameters)
#103=0.91      (Underfeed, 0.91 -> 9 %)
#104=[#103 * 1.0/#2]   (feed rate adjusted for under feed)

G0 X0 Y0
G0 Z#4
M98 P1
M5 M9
M30


O1
G95 F#104
S#3 M3 M8
G4P4
G1 Z[#103 * #1/-1]
S#3 M4
G4P0.5
G1 Z#4
G94
M99


Macro Doesn't work:

'M975.m1s  Tapping Macro
'
'Set Editable Parameters in Main Program
'#1=0.36         (Set Thread Depth)
'#2=16.0         (Set Thread Pitch in Turns per Inch)
'#3=400         (Set RPM)
'#4=0.1      (Set Rapid Height)

(Internal Parameters)

OrigFeed = GetOEMDRO(55)
CODE "#103=0.91"      'Underfeed, 0.91 -> 9 %
CODE "#104=[#103 * 1.0/#2]"  'feed rate adjusted for under feed

CODE "G95 F#104"
CODE "S#3 M3 M8"
CODE "G4 P4"
CODE "G1 Z[#103 * #1/-1]"
CODE "S#3 M4"
CODE "G4 P0.5"
CODE "G1 Z#4"
CODE "G94"
CODE "F" & OrigFeed

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #1 on: November 02, 2011, 01:40:24 PM »
COde looks ok here . HOW have you got your Spindle setup? do you have an index to show true RPM,  do you have the spindle synced to feedrate?

(;-) TP
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #2 on: November 02, 2011, 02:05:16 PM »
No, I have all delays set to Zero.  But I do not have spindle feedback. (Floating tapping head)
The G95 works okay in the sub routine though.

Richard

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #3 on: November 02, 2011, 02:13:21 PM »
The macro may be outrunning the Gcode side. You may have to add wait states to keep things in sync between the CB side and the Gcode side.

'M975.m1s  Tapping Macro
'
'Set Editable Parameters in Main Program
'#1=0.36         (Set Thread Depth)
'#2=16.0         (Set Thread Pitch in Turns per Inch)
'#3=400         (Set RPM)
'#4=0.1      (Set Rapid Height)

'(Internal Parameters)

OrigFeed = GetOEMDRO(55)
CODE "#103=0.91"      'Underfeed, 0.91 -> 9 %
CODE "#104=[#103 * 1.0/#2]"  'feed rate adjusted for under feed

CODE "G95 F#104"
While Ismoving()
Wend
CODE "S#3 M3 M8"
CODE "G4 P4"
CODE "G1 Z[#103 * #1/-1]"
While Ismoving()
Wend
CODE "S#3 M4"
CODE "G4 P0.5"
CODE "G1 Z#4"
While Ismoving()
Wend
CODE "G94"
CODE "F" & OrigFeed

(;-) TP


Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #4 on: November 03, 2011, 11:54:53 AM »
I have run it 10 ways to sundays here and it works fine every time.

What version of mach3 are you running?

If you look in the mode line does it show switching to G95??

Are you sure you have your #vars set before you run the Macro?

(;-) TP
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #5 on: November 03, 2011, 12:40:34 PM »
I'm running the latest stable release from the website three weeks ago.
Are you running my code or the code after you modified it?

I will check the mode and make sure it's changing. 

Here is the code that calls the macro.

(Tapping Test Program)
G40 G80 G90

(Set Editable Parameters in Main Program)
#1=0.500         (Set Thread Depth)
#2=16.0         (Set Thread Pitch in Turns per Inch)
#3=400         (Set Tapping RPM)
#4=0.1      (Set Rapid Height)

G0 X0 Y0
G0 Z0.0
M975
M30

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #6 on: November 03, 2011, 12:42:33 PM »
I was running your code I will test with your Gcode program call.

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #7 on: November 03, 2011, 12:51:07 PM »
It failed on the Gcode file call from your file. The problem is a Sync problem with CB and Gcode inside the macro .

To fix add in a wait state after the G95 call Forcing Mach3 to WAIT until it has completed the G95 call update. NOW you may have to add more or less wait states with YOUR system.  It seems to be CPU related as to the waits required.

IF it were my code I would use the WhileIsmoving() Wend after each Code"" line to make SURE it stays in sync.

THAT is why I recommended you use a Gcode SUB routine call. It does NOT have the sync problems, But some of the latest version did have a bug that created a loop in the subs. DOn't know if that ever got fixed.

'M975.m1s  Tapping Macro
'
'Set Editable Parameters in Main Program
'#1=0.36         (Set Thread Depth)
'#2=16.0         (Set Thread Pitch in Turns per Inch)
'#3=400         (Set RPM)
'#4=0.1      (Set Rapid Height)

'(Internal Parameters)

OrigFeed = GetOEMDRO(55)
CODE "#103=0.91"      'Underfeed, 0.91 -> 9 %
CODE "#104=[#103 * 1.0/#2]"  'feed rate adjusted for under feed

CODE "G95 F#104"
While Ismoving()
Wend
CODE "S#3 M3 M8"
CODE "G4 P4"
CODE "G1 Z[#103 * #1/-1]"
CODE "S#3 M4"
CODE "G4 P0.5"
CODE "G1 Z#4"
CODE "G94"
CODE "F" & OrigFeed
« Last Edit: November 03, 2011, 12:57:33 PM by BR549 »
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #8 on: November 03, 2011, 02:01:43 PM »
Let me give it try.  I appreciate it very much!!!!

Richard
Re: I can't get the G95 feedrate to work properly in Macro
« Reply #9 on: November 04, 2011, 09:17:29 AM »
Yep,  That fixed it here to.  The sub routine does actually work a lot smoother and faster but then it has to be copied over to each one of my files each time.  It just seems like a "cleaner" approach to use the macro.

Once I got it working I could tweak it and get it working exactly the way I wanted to.  Cat's meow.

It's kind of a shame the the canned routines like the G84 tapping can have some sort of configuration were we can customize to our on machine.  That seems like it would work well.

Thanks for all the help.
Richard