Setting up a tool changer

More
20 Jan 2012 11:28 #16970 by fferraz
Nice, thanks a lot for your help, andy, you're being so kind to help us... I should sent some jewelry your way when everything is setup and workin! :laugh:

So, yesterday after your last post, I've talked with the guy who built and set the turret for us on the Mach3 config, and I discovered that what it uses to change the tools is something completely different. Actually it uses only 2 output bits, one to enable the change and the other where it gives X number of pulses, depending on the tool number. I have the VB script it uses on Mach3, I think it'll be easier to explain looking at it... I'll put my commentaries after a # signal:

#gets selected tool and current tool and checks if they're different
newtool = GetSelectedTool()
tool = GetCurrentTool()
If tool <> newtool Then
#Driving parallel port pin 14 to logic high level.
ActivateSignal (9)
#Here it'll do one pulse of active/inactive to parallel port pin 16 in each cycle... so, for example, for tool 4, there'll be 4 pulses. There should be a pause of at least 20 mSec between each pulse. Here it's set to 50.
Dim a
While a<newtool
a=a+1
ActivateSignal (10)
Sleep (50)
DeActivateSignal (10)
Sleep (50)
Wend
End If
#finally it drives pin 14 back to low level, pauses for 2500 mSec and waits for input1 (parallel port pin 10) to be high = (tool changed)
DeActivateSignal (9)
Sleep (2500)
SystemWaitfor (input1)
SetCurrentTool( tool )


So there it is... could you help me translating that to HAL?

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 11:46 #16971 by BigJohnT
That would be easy to do in Classicladder. My CHNC example all ready has the handshaking done with M6, you would just have to change the internal part to suit your needs.

John

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 11:57 #16972 by andypugh
fferraz wrote:

So there it is... could you help me translating that to HAL?


It is probably possible to do it in HAL, but you might need to use the EMC2 equivalent of VBscript, ie comp:
linuxcnc.org/docs/html/hal_comp.html

I assume that there is some form of microcontroller in the toolchanger which responds to these pulses?

To do this purely in HAL without any actual programming I think you would need to use a stepgen to create the pulses, then increment the "position" by the new tool number, and then the handshaking will get a bit difficult.

I think that it would be easier to create a userspace component, pretty much exactly like the VB code, but I would need access to an EMC2 machine to write and debug that, so it will have to wait until this evening.

If your VB guy can code in C, and he is willing, then perhaps he can look at the comp page?
In EMC2 the modules don't drive parallel port pins directly, they create HAL virtual pins, which are routed to the the Parport in the HAL file. (This means that it is easy to run several instances of a module, or to change the pin allocation)
If you are using sleep/wait for the timing then the component _has_ to be a Userspace component. Realtime components have to run and exit in much less than the rate of the thread they are running in. (To perform a task like this in a realtime component you would use a state-machine)

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 12:07 #16973 by andypugh
BigJohnT wrote:

That would be easy to do in Classicladder.


Good point, I always forget about ClassicLadder.

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 12:36 #16974 by fferraz
BigJohnT wrote:

That would be easy to do in Classicladder. My CHNC example all ready has the handshaking done with M6, you would just have to change the internal part to suit your needs.

John


Ok, so Classicladder is the way to go... I have to be honest, John, I'm pretty lost when looking at your config files, specially since I know NOTHING about classicladder... I see that in your hardinge.hal file you have two sections dedicated to the tool changer, # Tool Turret Encoder Setup and # Tool Turret tool change and that, from there, you call the classicladder program.

But where should I do the changes to suit my needs, as you said?

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 12:55 #16975 by BigJohnT
Well, you don't need the turret encoder I assume you don't have one. You would have to open up the ladder in Axis to view it. The parts you would have to change would be in the classicladder part. What you do is translate your basic to ladder one line at a time and place that inside the handshaking with M6.

From memory when the ladder is called it does something like this

if the tool request is the same one that is loaded
return tool change done
else
spin turret
when tool turret encoder is equal to the tool requested stop turret
when tool turret is locked down return tool change done

ignore the part at the end that is my way oiler

The biggest hurdle of classicladder is getting use to the interface imho.

Ladder logic is pretty simple
read inputs
solve logic
update output

The golden rule of ladder logic is "last one wins" which means you can only have an output once in your ladder as the last one will determine the state of that output.

John

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 13:06 #16976 by andypugh
fferraz wrote:

Ok, so Classicladder is the way to go


I just thought of another way....

You _could_ do it all in G-code, calling a G-code subroutine which toggles the pins with M64 / M65.

You could even call that G-code automatically with M6.
linuxcnc.org/docview/devel/html/remap/st...lated_codes_t_m6_m61

So, that's 4 ways to do it so far...

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 13:09 #16977 by BigJohnT
G Code Remapping is only in Master right?

John

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 13:20 #16978 by andypugh
BigJohnT wrote:

G Code Remapping is only in Master right?


It looks like it, yes.

CL is probably easiest in a standard install, as you said.

Please Log in or Create an account to join the conversation.

More
20 Jan 2012 13:28 #16979 by BigJohnT
Is this one of those tool changers that you always go one direction to a point that is calculated based on the current tool position and the requested tool position then back up a bit to a hard stop? I forget the name MyFord or something like that...

John

Please Log in or Create an account to join the conversation.

Time to create page: 0.166 seconds
Powered by Kunena Forum