Hello Guest it is March 28, 2024, 09:28:26 PM

Author Topic: Mach3 stops at the macro. Why?  (Read 1757 times)

0 Members and 1 Guest are viewing this topic.

Mach3 stops at the macro. Why?
« on: March 15, 2018, 02:52:49 PM »
Hello,
i am using a CSMIO/IP-S. / Mach3 Ver. 22.
I am running a plasmacutter and i want it to find the top of the material on every start.
But with G28.1 it doesnt work, so CS Lab send me a macro.
But if i want to run the g code from 140 and hit "run from here", Mach3 stops at the first M20 in line 15 and i cannot start. I only can start the g code from the beginng.
Here is the G Code
Quote
N0010 (Filename: 1,5mm Platte1.tap)
N0020 (Post processor: Mach3 2 headsM20.scpost)
N0030 (Date: 15.03.2018)
N0040 G21 (Units: Metric)
N0050 G53 G90 G40
N0060 F1
N0070 S500
N0080 (Part: 1,5mm Platte1)
N0090 (Operation: Radiuskorrektur außen, 0, T1: Plasma 1-2mm 1800)
N0100 (Plasma 1-2mm 1800)
N0110 T1 M06  G43 H1
N0120 G00 Z25.0000
N0130 X407.7900 Y-828.1611
N0140 Z10.0000
N0150 M20 Q2
N0160 G00 Z2
N0170 M03 G01 Z1.0000 F1200
N0180 G02 X408.7500 Y-827.2011 I0.9600 J0.0000 F2000.0
N0190 G01 X409.5000 F2000
N0200 Y-839.5000
N0210 X397.9680
N0220 Y-827.2011
N0230 X408.7500
N0240 G02 X408.7500 Y-828.5587 I-0.6788 J-0.6788 F2000.0
N0250 M05
N0260 G00 Z25.0000
N0270 X396.4058 Y-851.4600
N0280 Z10.0000
N0290 G00 Z2
N0300 M03 G01 Z1.0000 F1200
N0310 G02 X397.3658 Y-850.5000 I0.9600 J0.0000 F2000.0
N0320 G01 X398.1158 F2000
N0330 Y-865.3707
N0340 X375.5000
N0350 Y-850.5000
N0360 X397.3658
N0370 G02 X397.3658 Y-851.8576 I-0.6788 J-0.6788 F2000.0
N0380 M05
N0390 G00 Z25.0000
N0400 X377.7900 Y-796.4600
N0410 Z10.0000
N0420 G00 Z2
N0430 M03 G01 Z1.0000 F1200
N0440 G02 X378.7500 Y-795.5000 I0.9600 J0.0000 F2000.0
N0450 G01 X379.5000 F2000
N0460 Y-824.5000
N0470 X365.5000
N0480 Y-795.5000
N0490 X378.7500
N0500 G02 X378.7500 Y-796.8576 I-0.6788 J-0.6788 F2000.0
N0510 M05
N0520 G00 Z25.0000
N0530 X344.0362 Y-805.0611
N0540 Z10.0000
N0550 G00 Z2
N0560 M03 G01 Z1.0000 F1200
N0570 G02 X344.9962 Y-804.1011 I0.9600 J0.0000 F2000.0
N0580 G01 X345.7462 F2000
N0590 Y-820.6054
N0600 X327.8070
N0610 Y-804.1011
N0620 X344.9962
N0630 G02 X344.9962 Y-805.4587 I-0.6788 J-0.6788 F2000.0
N0640 M05
N0650 G00 Z25.0000
N0660 X331.4101 Y-826.4600
N0670 Z10.0000
N0680 M20 Q2
N0690 G00 Z2
N0700 M03 G01 Z1.0000 F1200
N0710 G02 X332.3701 Y-825.5000 I0.9600 J0.0000 F2000.0
N0720 G01 X333.1201 F2000
N0730 Y-851.4533
N0740 X320.5000
N0750 Y-825.5000
N0760 X332.3701
N0770 G02 X332.3701 Y-826.8576 I-0.6788 J-0.6788 F2000.0
N0780 M05
N0790 G00 Z25.0000
N0800 X424.9949 Y-807.3814
N0810 Z10.0000
N0820 G00 Z2
N0830 M03 G01 Z1.0000 F1200
N0840 G02 X423.7497 Y-806.8404 I-0.3521 J0.8931 F2000.0
N0850 G03 X423.7497 Y-806.8404 I-58.7497 J-23.1596
N0860 G02 X424.2908 Y-805.5952 I0.8931 J0.3521
N0870 M05
N0880 G00 Z25.0000
N0890 X132.7900 Y-876.4600
N0900 Z10.0000
N0910 M20 Q2
N0920 G00 Z2
N0930 M03 G01 Z1.0000 F1200
N0940 G02 X133.7500 Y-875.5000 I0.9600 J0.0000 F2000.0
N0950 G01 X134.5000 F2000
N0960 Y-884.5000
N0970 X120.5000
N0980 Y-875.5000
N0990 X133.7500
N1000 G02 X133.7500 Y-876.8576 I-0.6788 J-0.6788 F2000.0
N1010 M05
N1020 G00 Z25.0000
N1030 X142.7900 Y-911.4600
N1040 Z10.0000
N1050 G00 Z2
N1060 M03 G01 Z1.0000 F1200
N1070 G02 X143.7500 Y-910.5000 I0.9600 J0.0000 F2000.0
N1080 G01 X144.5000 F2000
N1090 Y-919.5000
N1100 X130.5000
N1110 Y-910.5000
N1120 X143.7500
N1130 G02 X143.7500 Y-911.8576 I-0.6788 J-0.6788 F2000.0
N1140 M05
N1150 G00 Z25.0000
N1160 X87.7900 Y-911.4600
N1170 Z10.0000
N1180 G00 Z2
N1190 M03 G01 Z1.0000 F1200
N1200 G02 X88.7500 Y-910.5000 I0.9600 J0.0000 F2000.0
N1210 G01 X89.5000 F2000
N1220 Y-929.5000
N1230 X80.5000
N1240 Y-910.5000
N1250 X88.7500
N1260 G02 X88.7500 Y-911.8576 I-0.6788 J-0.6788 F2000.0
N1270 M05
N1280 G00 Z25.0000
N1290 X92.7900 Y-866.4600
N1300 Z10.0000
N1310 G00 Z2
N1320 M03 G01 Z1.0000 F1200
N1330 G02 X93.7500 Y-865.5000 I0.9600 J0.0000 F2000.0
N1340 G01 X94.5000 F2000
N1350 Y-874.5000
N1360 X80.5000
N1370 Y-865.5000
N1380 X93.7500
N1390 G02 X93.7500 Y-866.8576 I-0.6788 J-0.6788 F2000.0
N1400 M05
N1410 G00 Z25.0000
N1420 X168.2539 Y-872.9286
N1430 Z10.0000
N1440 M20 Q2
N1450 G00 Z2
N1460 M03 G01 Z1.0000 F1200
N1470 G02 X167.0076 Y-872.3901 I-0.3539 J0.8924 F2000.0
N1480 G03 X167.0076 Y-872.3901 I-57.0076 J-22.6099
N1490 G02 X167.5461 Y-871.1438 I0.8924 J0.3539
N1500 M05
N1510 G00 Z25.0000
N1520 M05
N1530 M05
N1540 G00 Z220
N1550 G00 X0 Y0
N1560 M30
and here is the M20 Macro
Quote
'===============================================================================================================

'Macro automatycznego pomiaru wysokoœci materia³u V2
'2013-03-17 22:18

'===============================================================================================================

Const SpeedProbe      = 700    'Prêdkoœæ pomiaru
Const MaxRouteDown      = 20   'Maxymalny zjazdy palnika od pozycji startu pomiaru (w mm)
Const ClearanceContactor   = 2   'Luz czujnika (w mm)

'===============================================================================================================
Dim ZDROsaveCord    'Pozycja osi Z przed wywo³aniem PROBE
Dim ZTouchPosition   'Pozycja psi Z po wykryciu sygna³u PROBE
Dim Qarg      'Wysokoœæ podniesienia palnika ponad materia³ po pomiarze
Dim Inc         'Gdy 1 ruch inkrementalny , 0 absolutny
Dim MachCoor      'Gdy 1 kordynaty programowe
Dim FeedCurrent

'===============================================================================================================
      'G³ówny program
'===============================================================================================================

Sub Main

'--------------------------------------------------------------------
   Qarg = Param2()
   If GetOEMLed(806) Or GetOEMLed(807) Or GetOEMLed(809) Then
      StopRewindSleep
      Message"ERROR: Maszyna nie zbazowana / machine not homing  !!!"
      End
   ElseIf GetOEMLed(11) Then
      StopRewindSleep
      Message"ERROR: Palnik pracuje / burner works"
      End
   ElseIf GetOemLed (825) Then
      StopRewindSleep       
         Message"ERROR > Czujnik aktywny / active sensor !!!"
         End
      ElseIf Qarg = -1 Then
      StopRewindSleep         
         Message"ERROR: Nie podano wartoœci Q / There is no value Q  !!!"
         End      
      ElseIf Qarg < 0 Then
      StopRewindSleep         
         Message"ERROR:  Q = " & Qarg & " !!! wprowadz Q > 0 / enter Q> 0"
         End   
     End If
'--------------------------------------------------------------------
   SaveMachCoor
   SaveIncAbs
      SaveFeedCurrent     
      ZDROsaveCord = GetOEMDro(802)
'--------------------------------------------------------------------
      Zlimit = ZDROsaveCord - Abs(MaxRouteDown)
         
      Code "G31 Z" & Zlimit & "F" &SpeedProbe
   WaitForMove
         
      ZTouchPosition = GetVar(2002)
      
      'Gdy nie wykryto materia³u powrót do punktu startu probe
      If ZTouchPosition = Zlimit Then    
         Message"ERROR: Nie wykryto materia³u / Not detected material !!!"   
         Code"G0 Z" &ZDROsaveCord
      WaitForMove
      StopRewindSleep
      RestoreFeedCurrent   
      RestoreIncAbs   
      RestoreMachCoor
      End
   End If

      Code "G0 Z" &(ZTouchPosition + Abs(ClearanceContactor) + Qarg)
   WaitForMove
      SetOEMDRO(802, Qarg)
   RestoreFeedCurrent
   RestoreIncAbs
   RestoreMachCoor
   End
End Sub
'===============================================================================================================
      'Funkcje
'===============================================================================================================
Sub SaveMachCoor ()
   If GetOEMLed(16) Then
      DoOEMButton(256)
      MachCoor = 1
   Else   
      MachCoor = 0
   End If
End Sub
'-------------------------------------------
Sub RestoreMachCoor ()
   If MachCoor = 1 Then
      If Not GetOEMLed(16) Then
         DoOEMButton(256)
      End If
   Else   
      If GetOEMLed(16) Then
         DoOEMButton(256)
      End If
   End If
End Sub
'-------------------------------------------
Sub SaveIncAbs ()
     If GetOEMLed(49) Then
      Code"G90"
      WaitForMove
      Inc = 1
   Else
      Inc = 0
   End If
End Sub
'-------------------------------------------
Sub RestoreIncAbs ()
   If Inc = 1 Then
      Code"G91"
      WaitForMove
   Else
      Code"G90"
      WaitForMove
   End If
End Sub
'-------------------------------------------
Sub SaveFeedCurrent ()
      FeedCurrent = GetOEMDRO(818)
End Sub
'-------------------------------------------
Sub RestoreFeedCurrent ()
      Code "F" &FeedCurrent
   WaitForMove

End Sub
'-------------------------------------------
Sub StopRewindSleep ()
   DoOEMButton(1003)
   DoOEMButton()
   Sleep(150)
End Sub
'-------------------------------------------
Sub WaitForMove ()
   While IsMoving()
      Sleep(15)
   Wend
End Sub
Someone any idea?
Re: Mach3 stops at the macro. Why?
« Reply #1 on: March 15, 2018, 03:33:37 PM »
If i use Version .62 from Mach3. Then i get an message "ePID Fault" while probing

Offline TPS

*
  •  2,501 2,501
    • View Profile
Re: Mach3 stops at the macro. Why?
« Reply #2 on: April 04, 2018, 01:43:39 AM »
HI,
there is a fault in your M20 macro at the SUB StopRewindSleep

Code: [Select]
'-------------------------------------------
Sub StopRewindSleep ()
   DoOEMButton(1003)
   DoOEMButton()
   Sleep(150)
End Sub


the DoOEMButton(), because the Argument is not optional.

because of the Name of the SUB i think it should be:

DoOEMButton(1002)

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.