Hello all,
This is the Macro I shamelessly stole from Hood in another post. It works, but only in one direction. I.E., I can index from position 1 to position 2, etc., but If i try to go from 1 to 8, I get a message saying "limit switch triggered." If I go into the homing config menu and reverse the direction, it works in the new direction, but not in the previous. I hope that makes sense. The machine is a mid 80s CHNC with 8 position turret. I removed the original air motor and replaced with a stepper running as the A axis. The stepper indexes ok, and the macro raises and lowers the turret correctly. Jut won't let me go in both directions. Additionally, I have a switch to sense turret up/down position. I'd like to add something to the code to ensure the stepper doesn't run until Mach knows the turret is up for sure. Any ideas?
Next issue: I have a home switch for the turret. How do I get Mach to home it from the basic lathe screen. Can I add a "home turret" button in with the home x and z buttons?
I really appreciate the help from the forum. This is my first experience with Mach. I currently have my X and Z axes moving nicely with servos and Granite drives, the spindle runs via VFD and AC induction motor, and the coolant pump, air collet closer and part chute are working nicely as well. All via SmoothStepper and C23 BOB. The turret is my last big challenge.
Thanks,
Kevin
Here is the Macro I'm using:
If GetSelectedTool() = GetCurrentTool() Then
End
End If
Code "G53 G0 Z-1"
While IsMoving()
Wend
If GetSelectedTool = 1 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A0"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 2 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A45"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 3 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A90"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 4 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A135"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 5 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A180"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 6 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A225"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 7 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A270"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If
If GetSelectedTool = 8 Then
ActivateSignal(OutPut7)
Sleep 500
Code "G53 G0 A315"
While IsMoving()
Wend
DeActivateSignal(OutPut7)
End If