Hello Guest it is September 17, 2019, 05:35:17 AM

Author Topic: Mach 3 toolchange for dummies???  (Read 60485 times)

0 Members and 1 Guest are viewing this topic.

Re: Mach 3 toolchange for dummies???
« Reply #20 on: February 24, 2011, 10:22:04 PM »
here is another simple code to do tool change:
Sub Main()

NumSlots=8
OldTurretPos=(GetOEMDRO(803))
OldToolSlot=Abs(GetOEMDRO(803)*8)
NextTool = GetSelectedTool()
NextToolSlot = (NextTool-1)*360/NumSlots


If OldToolSlot = NextToolSlot Then
SetCurrentTool(NextTool)
Exit Sub
End If

If NextTool>8 Or NextTool<1 Then
Message("Next Tool out of range")
Exit Sub
End If

MoveDis = (NextToolSlot-OldTurretPos)

 If Abs(MoveDis) >180 Then
   If MoveDis < 0 Then     
     MoveDis = 360 - MoveDis     
   Else     
     MoveDis = MoveDis + 360   
   End If     
 End If
 
ActivateSignal(OUTPUT3)  'Release Turret holding pin
Code "G4 P0.5"
While IsMoving ()       
Wend
Code "G00 G91 a" & MoveDis       
While IsMoving ()       
Wend

DeActivateSignal(OUTPUT3)  'Engage Turret holding pin     

SetCurrentTool(NextTool)
Code "G90"
End Sub
         
Output 3 is what ever you use to engage/disengage turret lock.
803 is the oem code for the a axis.
set the a axis to angular on the General config page
check auto tool change
Re: Mach 3 toolchange for dummies???
« Reply #21 on: February 24, 2011, 10:25:39 PM »
that should be *8 and not the emoticon
Re: Mach 3 toolchange for dummies???
« Reply #22 on: February 25, 2011, 09:25:11 PM »
This should be the one.! it works on my hardinge.


Sub Main()

NumSlots=8
OldTurretPos=(GetOEMDRO(803))
OldToolSlot=Abs(GetOEMDRO(803))
NextTool = GetSelectedTool()
NextToolSlot = (NextTool-1)*45


If OldToolSlot = NextToolSlot Then
SetCurrentTool(NextTool)
Exit Sub
End If

If NextTool>8 Or NextTool<1 Then
Message("Next Tool out of range")
Exit Sub
End If

MoveDis = (NextToolSlot-OldTurretPos)

 If Abs(MoveDis) <180 Then
   If MoveDis > 0 Then     
     MoveDis = 360 + MoveDis     
   Else     
     MoveDis = MoveDis - 360   
   End If     
 End If
 
ActivateSignal(OUTPUT3)  'Release Turret holding pin
Code "G4 P0.5"
While IsMoving ()       
Wend
Code "G00 G91 a" & MoveDis       
While IsMoving ()       
Wend

DeActivateSignal(OUTPUT3)  'Engage Turret holding pin     

SetCurrentTool(NextTool)
Code "G90"
End Sub
 
Re: Mach 3 toolchange for dummies???
« Reply #23 on: February 26, 2011, 02:11:18 PM »
Thanks for everyones input so far. I am still trying to figure out one thing though...

how do I set up an output pin on the SS C25 BOB to trigger the relay on my C11 BOB?

I woulds like to be able to do the following-

Type a command into MDI that will trigger a relay that will power my air solenoid. I would also like to be able to trigger the relay in G code with the VB script, but right now my most important objective is to have a button or MDI input command that will fire my relay and thus acticate my air solenoid.

I have the following-

Mach 3
SS
SS C25 BOB
C11 BOB
24V PS for the air solenoid
Air solenoid

I have set up Mach/Config/portspins/outputsignals to have output 1 enabled on port 1 pin 14. I have it set to active high so that I can have output 1 activate pin 14 to be 5vdc. I can then run that 5vdc to the C11 BOB to activate the relay that will send the 24v to the air solenoid...

How do I get mach 3 to trigger output 1, and thus make pin 14 have 5VDC?

Then, how do i run the 5VDC into the C11 BOB and make it trigger one of the (onboard) relay?

Also, how do I wire the 24VDC into the C11 BOB relay and how do I wire the 24VDC out from the relay.

Sheoot, seems like the only thing I know how to do is run 24VDC to the solinoid to manually trigger the air solenoid. This is quite entertaining BTW, and I managed to throughly impress my GF!

Offline Hood

*
  •  25,849 25,849
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #24 on: February 26, 2011, 08:12:25 PM »
I have not checked through the manuals for any of these boards but I had a look at the pics of the boards and this is how I think they would connect.


It would seem the C25 is board that provides screw connections for the SS so if using the C11 as well you will have to cut the end off a PP cables and wire it to the terminals of the C25 and plug in the other ends to the C11. What you will do then is set the port and pin number for the relay output up for OutPut1, that will mean the relay is activated when output 1 is. The 24v side is simply the +24v from supply to one of the terminals on the relays contact and the other contact then would go to your solenoid then the other side of the solenoid would connect to your 24v powers supplies 0v terminal.



Hood
Re: Mach 3 toolchange for dummies???
« Reply #25 on: February 26, 2011, 08:20:01 PM »
In the past several hours since I last posted I have removed the C25 board and connected the SS to the C11 with the ribbon cable.

I have mach 3 set up for output 1 being pin 1. when I run this-

"""""""""""""""""""""""""""""""""
ActivateSignal(OUTPUT1)


Sleep(8000)


DeactivateSignal(OUTPUT1) 
""""""""""""""""""""""""""""""""""
I get the C11 board activating pin 1 and triggering the relay for 8 seconds.

I have managed to wire up the solenoid to 24v- on one connection and the relay triggers the 24v+, this keeps the turret locked down until I run the script and the turret pops up for 8 seconds and then locks down again...

so...I am fairly functional. took me 11 hours though...

I also get the Estop triggering when the relay shuts off after 8 seconds.

I can run the above script, but I have not found any thing that I can enter into the MDI that will execute that code. Note I have the script saved as M11.m1s in the lathe macros folder. I made up M11, as I did not know what to name the script.

Any ideas?

Offline Hood

*
  •  25,849 25,849
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #26 on: February 26, 2011, 08:23:30 PM »
m11 in MDI should do it, however best use a number at least over 100 for the macro as numbers under 100 are really meant for Mach itself.

Hood
Re: Mach 3 toolchange for dummies???
« Reply #27 on: February 26, 2011, 08:25:40 PM »
I tried M11 in the MDI, no luck...

I will rename it and try it again.

Any idea why the estop triggers upon the relay "un-activating"?
Re: Mach 3 toolchange for dummies???
« Reply #28 on: February 26, 2011, 08:29:34 PM »
I renamed it M110 and I can now enter that in the MDI and it will trigger the relay.

Offline Hood

*
  •  25,849 25,849
  • Carnoustie, Scotland
    • View Profile
Re: Mach 3 toolchange for dummies???
« Reply #29 on: February 26, 2011, 08:38:13 PM »
Noise is likely your problem, how you will cure it I am not sure, that is the reason I like simple BOBs as you can do these types of things with seperate relays further away than the bob. Might be worth an email to Arturo at CNC4PC and see if he can suggest a fix. You could try increasing the fitering in the SS plugin but dont go too high, start at 1.43 and go up a bit if it doesnt work.
Hood