Hello Guest it is March 28, 2024, 06:28:14 AM

Author Topic: Macro Help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!  (Read 2817 times)

0 Members and 1 Guest are viewing this topic.

Macro Help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
« on: March 12, 2012, 12:24:09 AM »
 This macro is for Emco Compact 5  ( 6 tool holder).
I fail the test!  :-\
How I can include a limit switch at position (0)?
Without a syntax error?
I have no idea where is the error.
I will appreciate recommendations!!!
Thanks & Best regards!!

-----------------------------------------------------------------
 If GetSelectedTool() = GetCurrentTool() Then
 End If
 
 
 If GetSelectedTool = 0 Then
 ActivateSignal(OutPut7)          'Motor CW
 Sleep 500                              'Here I need a limit Switch ???
 ActivateSignal(OutPut6)          'Motor CCW
 While IsMoving(100)                'Wait
 Wend
 DeActivateSignal(OutPut7)
 DeActivateSignal(OutPut6)
 End If
 
 If GetSelectedTool = 1 Then
 ActivateSignal(OutPut7)
 Sleep 1000
 ActivateSignal(OutPut6)
 While IsMoving(100)
 Wend
 DeActivateSignal(OutPut7)
 DeActivateSignal(OutPut6)
 End If

  If GetSelectedTool = 2 Then
 ActivateSignal(OutPut7)
 Sleep 2000
 ActivateSignal(OutPut6)
 While IsMoving(100)
 Wend
 DeActivateSignal(OutPut7)
 DeActivateSignal(OutPut6)
 End If
 
 If GetSelectedTool = 3 Then
 ActivateSignal(OutPut7)
 Sleep 3000
 ActivateSignal(OutPut6)
 While IsMoving(100)
 Wend
 DeActivateSignal(OutPut7)
 DeActivateSignal(OutPut6)
 End If

 If GetSelectedTool = 4 Then
 ActivateSignal(OutPut7)
 Sleep 4000
 ActivateSignal(OutPut6)
 While IsMoving(100)
 Wend
 DeActivateSignal(OutPut7)
 DeActivateSignal(OutPut6)
 End If

 If GetSelectedTool = 5 Then
 ActivateSignal(OutPut7)
 Sleep 5000
 ActivateSignal(OutPut6)
 While IsMoving(100)
 Wend
 DeActivateSignal(OutPut7)
 DeActivateSignal(OutPut6)
 End If

 Call SetUserDRO(200,NewTool)
 SetCurrentTool
 End Sub

 Select Case ToolNumber
   Case Is=0
    Code"G00 X1.5"
    Code"G00 Z5.0"
   Case Is=1
    Code"G00 X1.5"
    Code"G00 Z5.0"
   Case Is=2
    Code"G00 X1.5"
    Code"G00 Z5.0"
   Case Is=3
    Code"G00 X1.5"
    Code"G00 Z5.0"
   Case Is=4
    Code"G00 X1.5"
    Code"G00 Z5.0"
   Case Is=5
    Code"G00 X1.5"
    Code"G00 Z5.0"
 End Select
 End Sub
 Main
Re: Macro Help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
« Reply #1 on: March 31, 2012, 09:44:47 AM »
try using

Code: [Select]
SystemWaitfor(inputx)
while ismoving()
wend

where inputx is the input at which you've connected your limit switch

Zafar