Hello Guest it is April 18, 2024, 03:55:14 AM

Author Topic: Mach3 Z-Axis direction problem after macro!  (Read 3954 times)

0 Members and 1 Guest are viewing this topic.

Mach3 Z-Axis direction problem after macro!
« on: January 15, 2015, 01:58:54 PM »
Hello,

I have a "new" problem (I think I had this problem before a few times in other situations):
My M6start and end macro moves the spindle to the toolchange position where i manually change it and press start.
It then measures the height of the new tool and begins with the next job. (Thats what it should do)
The problem is, after measuring the height it exceeds safe-z height and the limit switches trigger.
Normally  "Code "G0G53 Z" & GetOEMDRO(54)" would exactly go to safe-z
In this code example it wont.

And another creepy thing to mention is that it also fails to reference Z afterwards.. It references correctly, but then goes in the positive direction instead of negative while trying to clear the limit-switch. (lucky me has only a relatively weak spindle with a motor that detects overcurrent)

The problematic code part:
        Code "G0G53 Z" & GetOEMDRO(54)
        Code "G0G53 X" & GetOEMDRO(1216) & "G0G53 Y" & GetOEMDRO(1217)

And the full code:
Code: [Select]
If GetOEMDRO (24) <>0 Then

code "g0 g53 x" & GetOEMDRO(1218) & "g0 g53 y" & GetOEMDRO(1219) 'Go to probe Position
While IsMoving()
Wend

SavedZ = GetOEMDRO(49)
SetOEMDRO(49, 0)
'Probing process
code "g0 g53 z" & -GetOEMDRO(1220) 'Eilfahrt bis "Tasterhöhe"
While IsMoving()
Wend
code "g31 z-1000 f700" 
While IsMoving()
Wend
code "M1002"

'Setting Variables
Z_Shift = GetOEMDRO (1221) 'Einstellbares Offset ggf.
Tool_Offset = getVar(2002)'Var method
Call setOEMDRO(42, Tool_Offset)
SetOEMDRO(49, SavedZ)

        Code "G0G53 Z" & GetOEMDRO(54)
        Code "G0G53 X" & GetOEMDRO(1216) & "G0G53 Y" & GetOEMDRO(1217)

'Re-enable coolant
If GetUSERLED(1200)<>1 Then
If GetOEMLED(12) Then
Else
DoOEMButton(114)
End If
SetUSERLED(1200, 1)
End If

Else
MsgBox "Keine Werkzeug-Nummer gewählt",0
End If 

Thanks !
Re: Mach3 Z-Axis direction problem after macro!
« Reply #1 on: February 05, 2015, 02:15:23 PM »
Zobacz to
My M6start

'---------------------------------------------------------------------------------------------------------------
' Automatyczny pomiar bazy materiałowej dla osi Z
' andmar2005
'---------------------------------------------------------------------------------------------------------------
Dim obecby_posow
Dim jakie_G

Const Podkladka_pomiarowa = 41.45  '<<TU PODAJEMY WYSOKOŚĆ PODKŁADKI POMIAROWEJ
'---------------------------------
Const o_ile = 8.55 '<< Tu podajemy o ile podniesie się w osi Z nad PODKŁADKE POMIAROWA
'---------------------------------
Const droga_pomiaru = -5 ' << Tu podajemy odcinek pomiaru -w osi Z pojedzie -5mm
'---------------------------------
Const posow_pomiaru = 25 ' << Tu podajemy posów pomiaru -w osi Z pojedzie F25
'---------------------------------
Sub Program
 zbazowonie_maszyny
 sprawdzam_wrzeciono
 sprawdzam_czujnik
 odczyt_F
 odczyt_G
'---------------------------------------------------------------------------------------------------------------
'Zaczyna pomiar
    Call SetOemDro(42,0)'UWAGA ZERUJE OWSET DANEGO NARZĘDZIA !!!!
    Sleep(100)
    DoOEMButton (1010) 'Zeruje dro osi Z
    Code "G4 P2" ' odmierza czas
    Code "G90"
    Code "G31 Z" & droga_pomiaru & "F" & posow_pomiaru 'Start pomiaru - jedzie w z do styku Podkladka_pomiarowa
    czekam_na_wykonanie
    Styk_sondy = GetVar(2002) 'Przechwytuje miejsce styku do Podkladka_pomiarowa
    Code "G0 Z" &Styk_sondy 'Powraca do miejsca styku
    czekam_na_wykonanie
    przekroczenie_Z
'---------------------------------------------------------------------------------------------------------------
'Jeśli narzędzie nie przekroczyło parametru droga_pomiaru
    Call SetDro (2, Podkladka_pomiarowa) ' Wpisuje wysokość PODKŁADKI POMIAROWEJ
    Czekam_na_wykonanie
    Code "G4 P0.25" 'odmierza czas
    odczytDroZ = GetDro(2)
    Code "G1 Z" & odczytDroZ + o_ile & "F300" 'Podnosi oś Z nad PODKŁADKE POMIAROWA
    Code "(Oś Z ustawiona na zerze materiału Przykładowo G54 w osi Z)" 'info o wykonaniu pomiaru
    czekam_na_wykonanie
 End If
 wpisuje_F
 wpisuje_G
End Sub
'---------------------------------------------------------------------------------------------------------------

Sub zbazowonie_maszyny ()
If GetOEMLed(807) Or GetOEMLed(808) Or GetOEMLed(809) Then
     bazowanie = MsgBox("Maszyna nie zbazowana"& Chr(10) &""& Chr(10) &"ZBAZUJ MASZYNE" ,16, "BAZOWANIE")
     End
End If
End Sub
'---------------------------------------------------------------------------------------------------------------

Sub sprawdzam_wrzeciono () 'Sprawdza czy wrzeciono pracuje
If GetOEMLed(11) Then
wrzeciono = MsgBox("Wrzeciono ON"& Chr(10) &""& Chr(10) &"WYŁĄCZAM >> WRZECIONO OFF <<" ,48,"TEST PRACY WRZECIONA")
  If wrzeciono = 1 Then
      Code "M5"
      Sleep (500)
      Message "Wrzeciono OFF"
      Sleep (100)
      czekam_na_wykonanie
  End If
End If
End Sub
'---------------------------------------------------------------------------------------------------------------

Sub sprawdzam_czujnik ()
If GetOemLed (825)=0 Then 'Sprawdź czy sonda jest zwarta przed pomiarem
     Else
     test = MsgBox("Sprawdź czujnik"& Chr(10) &""& Chr(10) &"JEST TERAZ ZWARTY" ,32, "TEST CZUJNIKA") 'Komunikat
     End
End If
End Sub
'---------------------------------------------------------------------------------------------------------------

Sub odczyt_F ()
   obecby_posow = GetOemDRO(818) 'odczyt aktualnego F
End Sub
'---------------------------------------------------------------------------------------------------------------
Sub wpisuje_F ()
    Code "F" & obecby_posow& 'wczytuje odczytany F
End Sub
'---------------------------------------------------------------------------------------------------------------

Sub odczyt_G ()
jakie_G = GetOemLED(48) 'odczyt G90 czy G91
End Sub
'---------------------------------------------------------------------------------------------------------------
Sub wpisuje_G ()
    If jakie_G = 0 Then 'przywraca odczytany G90 lub G91
    Code "G91"
    End If
End Sub

'---------------------------------------------------------------------------------------------------------------

Sub przekroczenie_Z ()
     test_Z= GetDro(2)
     If (test_Z) <= (droga_pomiaru) Then 'Oblicza czy nie przekroczyło droga_pomiaru
       pomiar = MsgBox("BRAK SYGNAŁU Z CZUJNIKA"& Chr(10) &""& Chr(10) &">> PONOW POMIAR OSI - Z - <<" ,16, "DROGA POMIARU")
       wpisuje_F
       wpisuje_G
       End
     End If
Sub End
'---------------------------------------------------------------------------------------------------------------

Sub czekam_na_wykonanie ()
   While IsMoving()
   Sleep(50)
   Wend
End Sub
'---------------------------------------------------------------------------------------------------------------
'Koniec   

Offline TPS

*
  •  2,505 2,505
    • View Profile
Re: Mach3 Z-Axis direction problem after macro!
« Reply #2 on: February 05, 2015, 02:29:16 PM »
Hello,

i think the line

code "M1002"

is the problem a macrocall in a macro gave allways problems to me.

oder vielleicht können wir auch auf deutsch weiter machen, da einige Kommentare auf Deutsch sind.

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