Hello Guest it is July 16, 2019, 11:14:51 PM

Author Topic: Can anyone help me mach this work?  (Read 1485 times)

0 Members and 1 Guest are viewing this topic.

Offline mike^3

*
  •  117 117
    • View Profile
Can anyone help me mach this work?
« on: November 17, 2013, 11:27:02 AM »
Hello, I am working with a friend on trying to make the ATC lathe tool changer work, but it keeps giving me a compile error. Any help?
This is for my CHNC II SP Hardinge. Any Help would be awesome!!!!



'Macro M6Start ATC turret
Sub MovePos(ByVal ToolNumber As Integer)


OldTool = GetCurrentTool()
NewTool = GetSelectedTool()
TCtime = 0

ToolNumber = NewTool

If NewTool = OldTool Then
Message" Same Tool,  NO ACTION"
End
**MOBILE CODE**

If  NewTool > 8 Or NewTool < 1 Then
MsgBox" Tool # not a valid Number 1-10 ONLY, ENDING Program RUN "
DoButton(3)
End
**MOBILE CODE**

Xx = "-0.2" 'Tool Change position X
Zz = "-0.2" 'Tool Change Position Z


'******************************

Code"G00"
Code "G53 X" & Xx
Code "G53 Z" & Zz
While IsMoving()
Wend



ActivateSignal(OutPut1)  'Deactivate Lathe Stop Dog
While Ismoving()
Wend
Message"Deactivate Lathe Stop Dog"
Sleep(1000)              ' Wait 1 sec for activation

ActivateSignal(OutPut2)   'Pop up lathe turret
While Ismoving()
Wend
Message"Disengage Turret"
Sleep(1000)               'Wait 1 sec for activation

   




Select Case ToolNumber      'Position to each tool number by input signal

      Case  = 1
        Do While Not Isactive(OemTrigger1)
         ActivateSignal(Output3)   'Start Air Drive
         Message" Start Air Drive"
                TCtime = (TCtime +1)
                        Sleep(1000)
            If TCtime > 10 Then
            Message" Tool Changer Timed Out, sequence ending"
            End
          **MOBILE CODE**
        Loop
         
        DeactivateSignal(output1)  'Stop Turret
         While Ismoving()
         Wend
         Message"Stop Turret"
         Sleep(1000)
        DeactivateSignal(OutPut3) 'Stop Air Drive
         While Ismovng
         Wend
         Message"Stop Air Drive"
         Sleep(1000)
        DeactivateSignal(Output2)    'Lower Turret to lock the tool
                While Ismoving()
         Wend
         Message "Engage Turret"
         Sleep(1000)              'Wait 1 sec for activation

      Case  = 2
        Do While Not Isactive(OemTrigger2)
         ActivateSignal(Output3)   'Start Air Drive
         Message" Start Air Drive"
         TCtime = (TCtime+1)
         Sleep(1000)
            If TCtime > 10 Then
            Message" Tool Changer Timed Out, sequence ending"
            End
            **MOBILE CODE**
         
        Loop
       
        DeactivateSignal(output1)  'Stop Turret
         While Ismoving()
         Wend
         Message"Stop Turret"
         Sleep(1000)
        DeactivateSignal(OutPut3) 'Stop Air Drive
         While Ismovng
         Wend
         Message"Stop Air Drive"
         Sleep(1000)
        DeactivateSignal(Output2)    'Lower Turret to lock the tool
                While Ismoving()
         Wend
         Message "Engage Turret"
         Sleep(1000)              'Wait 1 sec for activation



      Case  = 3
        Do While Not Isactive(OemTrigger3)
         ActivateSignal(Output3)   'Start Air Drive
         Message" Start Air Drive"
         TCtime = (TCtime+1)
         Sleep(1000)
            If TCtime > 10 Then
            Message" Tool Changer Timed Out, sequence ending"
            End
            **MOBILE CODE**
       
        Loop
       
        DeactivateSignal(output1)  'Stop Turret
         While Ismoving()
         Wend
         Message"Stop Turret"
         Sleep(1000)
        DeactivateSignal(OutPut3) 'Stop Air Drive
         While Ismovng
         Wend
         Message"Stop Air Drive"
         Sleep(1000)
        DeactivateSignal(Output2)    'Lower Turret to lock the tool
                While Ismoving()
         Wend
         Message "Engage Turret"
         Sleep(1000)              'Wait 1 sec for activation



      Case  = 4
        Do While Not Isactive(OemTrigger4)
         ActivateSignal(Output3)   'Start Air Drive
         Message" Start Air Drive"
         TCtime = (TCtime+1)
         Sleep(1000)
            If TCtime > 10 Then
            Message" Tool Changer Timed Out, sequence ending"
            End
            **MOBILE CODE**
       
        Loop
       
        DeactivateSignal(output1)  'Stop Turret
         While Ismoving()
         Wend
         Message"Stop Turret"
         Sleep(1000)
        DeactivateSignal(OutPut3) 'Stop Air Drive
         While Ismovng
         Wend
         Message"Stop Air Drive"
         Sleep(1000)
        DeactivateSignal(Output2)    'Lower Turret to lock the tool
                While Ismoving()
         Wend
         Message "Engage Turret"
         Sleep(1000)              'Wait 1 sec for activation


      Case  = 5
        Do While Not Isactive(OemTrigger5)
         ActivateSignal(Output3)   'Start Air Drive
         Message" Start Air Drive"
         TCtime = (TCtime+1)
         Sleep(1000)
            If TCtime > 10 Then
            Message" Tool Changer Timed Out, sequence ending"
            End
            **MOBILE CODE**
         
        Loop
       
        DeactivateSignal(output1)  'Stop Turret
         While Ismoving()
         Wend
         Message"Stop Turret"
         Sleep(1000)
        DeactivateSignal(OutPut3) 'Stop Air Drive
         While Ismovng
         Wend
         Message"Stop Air Drive"
         Sleep(1000)
        DeactivateSignal(Output2)    'Lower Turret to lock the tool
                While Ismoving()
         Wend
         Message "Engage Turret"
         Sleep(1000)              'Wait 1 sec for activation


      Case  = 6
        Do While Not Isactive(OemTrigger6)
         ActivateSignal(Output3)   'Start Air Drive
         Message" Start Air Drive"
         TCtime = (TCtime+1)
         Sleep(1000)
            If TCtime > 10 Then
            Message" Tool Changer Timed Out, sequence ending"
            End
            **MOBILE CODE**
        Loop
       
        DeactivateSignal(output1)  'Stop Turret
         While Ismoving()
         Wend
         Message"Stop Turret"
         Sleep(1000)
        DeactivateSignal(OutPut3) 'Stop Air Drive
         While Ismovng
         Wend
         Message"Stop Air Drive"
         Sleep(1000)
        DeactivateSignal(Output2)    'Lower Turret to lock the tool
                While Ismoving()
         Wend
         Message "Engage Turret"
                     'Wait 1 sec for activation


      Case  = 7
       Do While Not Isactive(OemTrigger7)
         ActivateSignal(Output3)   'Start Air Drive
         Message" Start Air Drive"
         TCtime = (TCtime+1)
         Sleep(1000)
            If TCtime > 10 Then
            Message" Tool Changer Timed Out, sequence ending"
            End
            **MOBILE CODE**
        Loop
       
        DeactivateSignal(output1)  'Stop Turret
         While Ismoving()
         Wend
         Message"Stop Turret"
         Sleep(1000)
        DeactivateSignal(OutPut3) 'Stop Air Drive
         While Ismovng
         Wend
         Message"Stop Air Drive"
         Sleep(1000)
        DeactivateSignal(Output2)    'Lower Turret to lock the tool
                While Ismoving()
         Wend
         Message "Engage Turret"
                       'Wait 1 sec for activation



      Case  = 8
        Do While Not Isactive(OemTrigger8)
         ActivateSignal(Output3)   'Start Air Drive
         Message" Start Air Drive"
         TCtime = (TCtime+1)
         Sleep(1000)
            If TCtime > 10 Then
            Message" Tool Changer Timed Out, sequence ending"
            End
            **MOBILE CODE**
         
        Loop
       
        DeactivateSignal(output1)  'Stop Turret
         While Ismoving()
         Wend
         Message"Stop Turret"
         Sleep(1000)
        DeactivateSignal(OutPut3) 'Stop Air Drive
         While Ismovng
         Wend
         Message"Stop Air Drive"
         Sleep(1000)
        DeactivateSignal(Output2)    'Lower Turret to lock the tool
                While Ismoving()
         Wend
         Message "Engage Turret"
         Sleep(1000)              'Wait 1 sec for activation


       

End Select

SetOemDro(824,NewTool)


End Sub



End