Hello Guest it is December 13, 2019, 03:16:18 AM

Author Topic: Little problem with my macro for zero piece  (Read 1096 times)

0 Members and 1 Guest are viewing this topic.

Re: Little problem with my macro for zero piece
« Reply #10 on: April 03, 2018, 08:24:08 AM »
Tryed....I'm apologize but the same results..
the macro M6 run While the Z axis find the Indicize input :(
Re: Little problem with my macro for zero piece
« Reply #11 on: April 03, 2018, 08:32:02 AM »
is it possible that the problems are in this follow macro?
becouse the M6 macro is ok...

Amove = -300   ' massimo movimento per ricerca probe verso Z-
speed = 300   ' velocità di ricerca
lo_speed = 30   ' velocità di ricerca low
Aret = 25   ' di quanto arretra l'asse dopo il sensing per il secondo approccio
Amove1 = -(Aret * 5)   ' massimo movimento per ricerca probe on Z- per il secondo punto
curr_tool = GetCurrentTool()   ' tool nel mandrino




If GetOemLed (825) <> 0 Then ' sente se il probe è triggerato o scollegato

Code "(Il probe è triggerato o scollegato o il modulo MP1 è spento)"
End
Else


Code "M5"   ' ferma il mandrino
Code "M8"   ' ferma il refrigerante
GotoSafeZ()   ' porta in posizione di sicurezza Z
While IsMoving()   ' completa il percorso
Wend

Code "M6 T8"   ' carica il probe dalla posizione 8 del carosello


Code "G91"   ' spostamento relativo
CurrentFeed = GetOemDRO(818) ' legge il feedrate corrente

' primo trigger Z


Code "F" & speed   ' porta il feedrate alla velocità di approccio

Code "G31 Z " & Amove
While IsMoving()   ' completa il percorso a meno che si triggeri il probe
Wend

' secondo trigger Z

Code "G01 Z " & Aret
While IsMoving()   ' completa il percorso a meno che si triggeri il probe
Wend

Code "F" & lo_speed   ' porta il feedrate alla velocità di approccio low
Code "G31 Z " & Amove1
While IsMoving()   ' completa il percorso a meno che si triggeri il probe
Wend





SetOemDRO(802,0)   ' offset asse Z

Code "F" & speed   ' porta il feedrate alla velocità iniziale


Code "M6 T0" & curr_tool   ' ricarica il tool che era nel caroselo

Code "F" & CurrentFeed ' ripristina il feedrate originale
Code "G90"   ' rimette lo spostamento assoluto
GotoSafeZ()   ' riporta in posizione di sicurezza Z
While IsMoving()   ' completa il percorso
Wend


End If

Offline TPS

*
  •  1,411 1,411
    • View Profile
Re: Little problem with my macro for zero piece
« Reply #12 on: April 03, 2018, 10:38:54 AM »
ok,
i have tested this on my machine, where i can do a real toolchange.

and you are absolute right, the macro is not waiting for the M6 to be finished.

so i made a Little Workaround.

code for the M6 call:

Code: [Select]
SetUserLed(1400,0)

Code "M6 T8"

While GetUserLed(1400) = 0
Sleep(50)
Wend

and then the last line in M6 is:

Code: [Select]
SetUserLed(1400,1)

so the calling macro has to wait until M6 set's UserLed(1400).

you have also to find an other mechanism to know that the run of M6 was faulty,
to cancel the main macro as well.

the trick with the UserLed is "dirty".
i would get the M6 code in a function inside your main macro, and create a returnvalue to
have the control in main macro by a fault.
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Little problem with my macro for zero piece
« Reply #13 on: April 03, 2018, 01:07:52 PM »
Thanks TPS...
But for you is the macro M6 defect or there is a problem when these two macros to work togeder?

Offline TPS

*
  •  1,411 1,411
    • View Profile
Re: Little problem with my macro for zero piece
« Reply #14 on: April 03, 2018, 02:19:26 PM »
no the M6 is not defect.
it seams to be handled different between G-Code call, and macro call.
i guess it is affected, because it is a "System" macro like M3 M4...
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline ger21

*
  • *
  •  6,291 6,291
    • View Profile
    • The CNC Woodworker
Re: Little problem with my macro for zero piece
« Reply #15 on: April 03, 2018, 02:56:01 PM »
Calling a macro from another macro is not a good idea in Mach3.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html