Hello Guest it is April 25, 2024, 09:36:43 AM

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 - chudson

Pages: 1
1
Hi Guys, first post here. I have built a VB script based on a few examples and other works to work with my Denford Mirac.

It has an 8 station tool changer and the position is identified using grey code - 3 digits , 1s or 0s (on or off)

The problem I'm having is I can only get positions 1 to 6 and when I try to get the positions that work they take around 5 minutes to even find the tool sometimes(spins round a few times, backs in as it thinks it has the tool, spins out as it releases it doesnt over and over). Positions 7 and 8 are 111 and 000 and for some reason the tool changer cant get those postions, it does stop on them but decides its not the tool were looking for. I have verfied the hardware is correct and working properly (I have 3 leds representing the grey code so I can see it visually). It surley can only be the code or Mach3.

Heres the code:

Dim Tool As Integer
Dim OldTool As Integer
Dim NewTool As Integer
Dim MaxToolNum As Integer
NewTool = 10
MaxToolNum = 8 'Maximum positions on Automatic Tool Changer
Tool = GetSelectedTool() 'Get the toolnumber from the command e.g T0101 M6 Tool number 1
OldTool = GetCurrentTool() 'Get current tool number


Call StartToolChanger

While NewTool <> Tool
Call CheckPins
Wend





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

Sub StartToolChanger
ActivateSignal(Output3) 'Turn on output signal to turn off spindle and turn on the atc
ActivateSignal(Output4) 'Turn atc forward
sleep 3000 'Needed to start atc otherwise it plays up
Call CheckPins

End Sub


Sub CheckPins
If IsActive(Input3) And Not IsActive(Input2) And Not IsActive(Input1) Then
NewTool = 1
Call StopTool
End If
If Not IsActive(Input3) And Not IsActive(Input2) And Not IsActive(Input1) Then
NewTool = 8
Call StopTool
End If
If Not IsActive(Input3) And Not IsActive(Input2) And IsActive(Input1) Then
NewTool = 4
Call StopTool
End If
If IsActive(Input3) And Not IsActive(Input2) And IsActive(Input1)Then
NewTool = 5
Call StopTool
End If
If IsActive(Input3) And IsActive(Input2) And IsActive(Input1) Then
NewTool = 7
Call StopTool
End If
If Not IsActive(Input3) And IsActive(Input2) And IsActive(Input1)Then
NewTool = 6
Call StopTool
End If
If Not IsActive(Input3) And IsActive(Input2) And Not IsActive(Input1) Then
NewTool = 2
Call StopTool
End If
If IsActive(Input3) And IsActive(Input2) And Not IsActive(Input1) Then
NewTool = 3
call StopTool
End If
End Sub

Sub Stoptool
DeActivateSignal(Output4) ' Stop running the ATC forward, if you don't do this the inverter will stop and the whole unit
' Will need to be turned off and on again
ActivateSignal(Output5) 'Run ATC in reverse
Sleep 3000 'Wait 3 seconds to allow the toolpost to lock in
DeActivateSignal(Output5) 'Stop running ATC in reverse
Sleep 1000

If Tool <> NewTool Then
Call StartToolChanger
SetCurrentTool(NewTool)
Else
SetCurrentTool(NewTool)
End If

DeActivateSignal(Output3) 'Turn off output to turn spindle back on

Stop
End Sub


           

Pages: 1