Hello Guest it is January 23, 2021, 12:38:53 AM

Author Topic: Out of place axis movement  (Read 1511 times)

0 Members and 1 Guest are viewing this topic.

Out of place axis movement
« on: December 06, 2013, 09:57:41 AM »
I've set up a couple OD grinders with Mach3 latest version .067. One grinder seems to do fine while the other, with identical code, makes "extra" movements. I've attached the part of the script that seems to be the culprit. Any ideas? I've deleted code that follows the problem.

Option Explicit
Dim FinishDim As Double
Dim ToGrind As Double
Dim HoldToGrind As Double
Dim Current As Double
Dim Remainder As Double
Dim SparkoutCounter As Integer
Dim RoughToGo As Double
Dim FinishToGo As Double
Dim RoughInc As Double
Dim FinishInc As Double
Dim Sparkouts As Integer
Dim LeftX As Double
Dim RightX As Double
Dim LeftFeedX As Double
Dim RightFeedX As Double
Dim PlungeFeedY As Double
Dim LeftDwell As Double
Dim RightDwell As Double
Dim AmountToGrind As Double

LeftDwell = GetOEMDRO(1110)
RightDwell = GetOEMDRO(1120)
FinishDim = GetOEMDRO(1056)
ToGrind = 0
AmountToGrind = 0
Current = 0
Remainder = 0
SparkoutCounter = 0
RoughToGo = 0
FinishToGo = 0
RoughInc = GetOEMDRO(1052)
FinishInc = GetOEMDRO(1053)
Sparkouts = GetOEMDRO(1054)
LeftX = GetOEMDRO(1060)
RightX = GetOEMDRO(1061)
LeftFeedX = GetOEMDRO(1162)
RightFeedX = GetOEMDRO(1163)
PlungeFeedY = GetOEMDRO(1064)

Current = GetOEMDRO(801)
ToGrind = Current - FinishDim
HoldToGrind = ToGrind * 1000000
ToGrind = HoldToGrind * .000001
AmountToGrind = ToGrind

rem last final Left over
Current = GetOEMDRO(801)
FinishDim = GetOEMDRO(1056)
Remainder = Current - FinishDim
HoldToGrind = Remainder * 1000000
Remainder = HoldToGrind * .000001

If (FinishDim <> Current) Then
   Code "M8 M3"
   Sleep 2000
rem turn On side travel
   If GetUserLed (1101) Then   (feed from left)
      Code "G90G01 X" & RightX & "F" & LeftFeedX
      Code "G04 P" & RightDwell
      Code "G90G01 Y" & FinishDim & "F" & PlungeFeedY     (*************** after this code the Y axis feeds back to original number,  before feed move)
      Remainder = 0                                                       (***** it doesn't do it when I run it on a computer in my office)
   End If
   If GetUserLed (1100) Then   (feed from right)
      Code "G90G01 X" & LeftX & "F" & RightFeedX
      Code "G04 P" & LeftDwell
      Code "G90G01 Y" & FinishDim & "F" & PlungeFeedY
      Remainder = 0
   End If
End If

Code "M9 M5"

Offline BR549

  •  6,942 6,942
    • View Profile
Re: Out of place axis movement
« Reply #1 on: December 08, 2013, 12:45:10 PM »
The problem that can arrise when you mix Macro "CB with Gcode is that they can get out of order sync. When it does you will see all kinds of strange moves. OR none. 

A liberal dose of

While Ismoving()

Statements after each instance of a Gcode call  or a write to a DRO/variable usually helps BUT it slows the program down and may cause less than smooth motion.

I find that mixing the two (macro/Gcode) does not always give stellar performance.

Now you can use macros to program the function as #vars then RUN the program from the Gcode side and get very good results. You may have to jump through a lot of hoops but it will work well that way.

(;-) TP