Hello Guest it is April 26, 2024, 07:24:54 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TPS

1341
here a new Version.
-all debug code deleted (faster Operation)
-Input 23 now used to stop reverse run
-after finish re check and retry

Code: [Select]
OldTool = GetCurrentTool()
Tool = GetSelectedTool()
MaxToolNum = 4      'Max number of tools for the changer

If OldTool = Tool Then
Message ("Selected Tool already loaded")
Exit Sub
End If

If Tool > MaxToolNum Then
Tool = Question ("Enter New Tool Number up to " & MaxToolNum)
End If

doagain:

Call StartTool

While NewTool <> Tool
   Call CheckPins
Wend

Call StopTool

're check
Call CheckPins
If NewTool <> Tool Then
goto doagain
End If

SetCurrentTool(NewTool)

'//// Subroutines /////////

Sub StartTool
   ActivateSignal(Output8)
End Sub

Sub CheckPins
   If GetCsmioIn(91,6) = True Then
      NewTool = 1
      End If
   If GetCsmioIn(91,5) = True Then
      NewTool = 2
      End If
   If GetCsmioIn(91,4) = True Then
      NewTool = 3
      End If
   If GetCsmioIn(91,3) = True Then
      NewTool = 4
      End If
End Sub

Sub Stoptool
   DeActivateSignal(Output8)
   ActivateSignal(Output9)
   'wait for input 23   
   While GetCsmioIn(91,7) = True
Sleep(20)
   Wend
   DeActivateSignal(Output9)
End Sub 

'CSMIO Eingang lesen
Function GetCsmioIn (ByVal adr As Integer, ByVal n As Integer) As Boolean
If(GetInBit(adr, n)) Then
GetCsmioIn = true
Else
GetCsmioIn = false
End If
End Function

1343
oh sh**t, missed that we are on a CSMIO Controller, sorry.
here the modified code:

Code: [Select]
OldTool = GetCurrentTool()
Tool = GetSelectedTool()
MaxToolNum = 4      'Max number of tools for the changer
debug = true

If debug = true Then
Message "OldTool: " & OldTool & " NewTool: " & Tool
Sleep(200)
End If

If OldTool = Tool Then
Message ("Selected Tool already loaded")
Exit Sub
End If

While Tool > MaxToolNum
Tool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend

Call StartTool

While NewTool <> Tool
   Call CheckPins
   While IsMoving()
   Wend
Wend

Call StopTool

SetCurrentTool(NewTool)

'//// Subroutines /////////

Sub StartTool
   ActivateSignal(Output8)
   If debug = true Then
Message "Output8 On"
Sleep(200)
   End If
   'Code "G4 P4.0"    'Wait for the tool to rotate past the sensor
      While IsMoving()
      Wend
End Sub

Sub CheckPins
   If GetCsmioIn(91,6) = True Then
      NewTool = 1
      End If
   If GetCsmioIn(91,5) = True Then
      NewTool = 2
      End If
   If GetCsmioIn(91,4) = True Then
      NewTool = 3
      End If
   If GetCsmioIn(91,3) = True Then
      NewTool = 4
      End If
  If debug = true Then
Message "NewTool= " & NewTool
Sleep(200)
  End If
End Sub

Sub Stoptool
   DeActivateSignal(Output8)
   If debug = true Then
Message "Output8 Off"
Sleep(200)
   End If
      While IsMoving()
      Wend
   ActivateSignal(Output9) 
   If debug = true Then
Message "Output9 On"
Sleep(200)
   End If
      Code "G4 P1.0"    'Wait for the tool to rotate onto ratchet stop
      While IsMoving()
      Wend
   DeActivateSignal(Output9)
   If debug = true Then
Message "Output9 Off"
Sleep(200)
   End If
      While IsMoving()
      Wend
End Sub 

'CSMIO Eingang lesen
Function GetCsmioIn (ByVal adr As Integer, ByVal n As Integer) As Boolean
If(GetInBit(adr, n)) Then
GetCsmioIn = true
Else
GetCsmioIn = false
End If
End Function

1344
General Mach Discussion / Re: Ref All Home
« on: April 25, 2019, 03:38:55 AM »
Quote
Note that I am moving up Z to the very top slowly FIRST. So there is nothing dangerous even if X and Y are in the wrong place. Where will G0 x25 Y25 (units in mm) send the head to ? The most it will happen is it is still slow referencing Y and X.

i noticed that the z-axis is up first, but i noticed on my machines, that sometimes after i fire up mach3
for the first time, that machine coords are somewhere (sometimes up to 500mm), and the machine is
physicaly  near 0,0. if you do then a G53 G0 X25 it will move full Speed into Limit Switches.

1345
Code: [Select]
ActivateSignal(Output8)
While NOT IsActive(Input22)
Sleep(50)
Wend
DeActivateSignal(Output8)

would be the code for a simple test

1346
Mach Screens / Re: chinese cnc probing macros?
« on: April 25, 2019, 02:51:16 AM »
all those "probing" macros will work, no question,
but the Point is the accuracy you whant to have?

but this is a complete other discussion and offtopic here.

1347
added some more debug info in this code. pls run this code and (assume you use Mach3 Standard
turn screenset) go to Diags. an use the History Button.
post the Textfile after running the macro.

Code: [Select]
OldTool = GetCurrentTool()
Tool = GetSelectedTool()
MaxToolNum = 4      'Max number of tools for the changer
debug = true

If debug = true Then
Message "OldTool: " & OldTool & " NewTool: " & Tool
Sleep(200)
End If

If OldTool = Tool Then
Message ("Selected Tool already loaded")
Exit Sub
End If

While Tool > MaxToolNum
Tool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend

Call StartTool

While NewTool <> Tool
   Call CheckPins
   While IsMoving()
   Wend
Wend

Call StopTool

SetCurrentTool(NewTool)

'//// Subroutines /////////

Sub StartTool
   ActivateSignal(Output8)
   If debug = true Then
Message "Output8 On"
Sleep(200)
   End If
   'Code "G4 P4.0"    'Wait for the tool to rotate past the sensor
      While IsMoving()
      Wend
End Sub

Sub CheckPins
   If IsActive(Input22) Then
      NewTool = 1
      End If
   If IsActive(Input21) Then
      NewTool = 2
      End If
   If IsActive(Input20) Then
      NewTool = 3
      End If
   If IsActive(Input19) Then
      NewTool = 4
      End If
  If debug = true Then
Message "NewTool= " & NewTool
Sleep(200)
  End If
End Sub

Sub Stoptool
   DeActivateSignal(Output8)
   If debug = true Then
Message "Output8 Off"
Sleep(200)
   End If
      While IsMoving()
      Wend
   ActivateSignal(Output9) 
   If debug = true Then
Message "Output9 On"
Sleep(200)
   End If
      Code "G4 P1.0"    'Wait for the tool to rotate onto ratchet stop
      While IsMoving()
      Wend
   DeActivateSignal(Output9)
   If debug = true Then
Message "Output9 Off"
Sleep(200)
   End If
      While IsMoving()
      Wend
End Sub 

1348
General Mach Discussion / Re: Ref All Home
« on: April 25, 2019, 02:23:34 AM »
for the Moment i can not see the real benefit of your script, because the
G0 X/Y25 moves are done in the actual fixture Offset (G54..).
let's say for example your G54 0,0 is in machine coords at 200,200 the machine
will go to 225/225 and do the ref X/Y.

faster would be to use G53 G0 X/Y25 then machine will go to 25mm from Limit Switches,
but this is dangerous if machine has not been homed before, because this 25,25 can be somewhere.

this are only my insignificant thoughts. ;)

1349
try this code, now you should see in Status line witch TC place is detected by the Inputs

Code: [Select]
OldTool = GetCurrentTool()
Tool = GetSelectedTool()
MaxToolNum = 4      'Max number of tools for the changer

Message "OldTool: " & OldTool & " NewTool: " & Tool
Sleep(200)

If OldTool = Tool Then
Message ("Selected Tool already loaded")
Exit Sub
End If

While Tool > MaxToolNum
Tool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend

Call StartTool

While NewTool <> Tool
   Call CheckPins
   While IsMoving()
   Wend
Wend

Call StopTool

SetCurrentTool(NewTool)

'//// Subroutines /////////

Sub StartTool
   ActivateSignal(Output8)
   'Code "G4 P4.0"    'Wait for the tool to rotate past the sensor
      While IsMoving()
      Wend
End Sub

Sub CheckPins
   If IsActive(Input22) Then
      NewTool = 1
      End If
   If IsActive(Input21) Then
      NewTool = 2
      End If
   If IsActive(Input20) Then
      NewTool = 3
      End If
   If IsActive(Input19) Then
      NewTool = 4
      End If
  Message "NewTool= " & NewTool
  Sleep(200)
End Sub

Sub Stoptool
   DeActivateSignal(Output8)
      While IsMoving()
      Wend
   ActivateSignal(Output9) 
      Code "G4 P1.0"    'Wait for the tool to rotate onto ratchet stop
      While IsMoving()
      Wend
   DeActivateSignal(Output9)
      While IsMoving()
      Wend
End Sub 

1350
CS-Lab / Re: CSMIO-ENC Spindle Orientation
« on: April 24, 2019, 12:03:34 PM »
i have also linked my Encoder Output from spindle servo to c axis and ENC module.
but i am doing the spindle orientation (for the ATC) on the servo drive, this is enabled
by a digital Input on the servo and reported back by a digital Output from the servo.