On Mon, 2010-10-04 at 17:11 -0400, Mike Cinquino wrote:
> Kirk,
> 
> Thanks, I a am now leaning toward classic ladder. I know ladder logic
> so it should be my quickest path to getting something working. My
> understanding is fuzzy on how to get a T? command to cause a bit or
> bits to react in classic ladder but once I have that mastered I should
> be set. I have been doing a lot of reading and going back and forth
> with different options and it's starting to get a little overwhelming.
> EMC is very powerful and flexible but there is a lot to learn.

(My memory is a little foggy, so verify what follows)
The T g-code word invokes a tool-prepare signal. The default setup just
loops that back to tool-prepared in the .hal file:
"
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
"

If you need to do something before the tool change, just break this loop
and insert connections to the Classic Ladder pins you created for your
tool changer. This allows you to prep your carousel or similar device
while still doing some machining.  My lathe turret cannot change
position during machining, so I leave the prepare loop connected. My
mill carousel needs to stay in position because the old tool needs to go
back into the empty pocket it came from, so again I left the prepare
loop connected. So if you need to prepare a tool before the change, do
it in this loop and when a T word shows up in your g-code the carousel
or whatever you have will shift to the new tool. More than one T word
may do more than one prepare.

When EMC2 gets to an M6, then the change loop comes into play:
"
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
"

For my lathe turret, I break this loop and connect my turret.comp pins
"
linkpp iocontrol.0.tool-change turret.0.position-change
linkpp turret.0.position-changed iocontrol.0.tool-changed
"

turret.0.position-change tells my turret to start doing its thing. EMC2
will be in a tool change state with axes motion and spindle stopped
until iocontrol.0.tool-changed goes high. In my turret comp, I don't set
turret.0.position-changed until the tool pocket encoder and the
requested tool match. If I forget to connect compressed air to the lathe
(for the turret and the collet closer) the turret won't rotate so the
pocket never matches so EMC2 stays in this state until I intervene (hook
up the air line or e-stop). That is why I need to add some time-outs
and a turret park check to my .comp file.

This passes EMC2's tool requested to my comp:
"
newsig TurretRequestedPosition s32
linksp TurretRequestedPosition iocontrol.0.tool-prep-number
linksp TurretRequestedPosition turret.0.position-requested
"

This is the old .hal form, I should probably use:
"
net TurretRequestedPosition iocontrol.0.tool-prep-number
turret.0.position-requested
"

> So it looks like I could use halui.tool.number or
> iocontrol.0.tool-number to give me the correct tool number.

Something like:
"
net MyChangerPocketRequested iocontrol.0.tool-prep-number
MyClassicLadderChangeMacro.0.MyPocketRequestedInput
"

Your Ladder routine will then have the requested tool number on the
MyClassicLadderChangeMacro.0.MyPocketRequestedInput pin.

> It also looks like when M6 is run iocontrol.0.tool-change is set high
> until iocontrol.0.tool-change is driven high?

Correction: "iocontrol.0.tool-changed" (note the "ed"), which is
supplied by your Ladder macro.

> My hal file will have this added to it.
> 
> net tool-prepare-loopback iocontrol.0.tool-prepare =>
> iocontrol.0.tool-prepared (not sure what this does exactly)

Basically bypasses the T word by setting "prepared" equal to "prepare",
but you still have the pocket number on "iocontrol.0.tool-prep-number"
for later when M6 comes along.

> net tool-change-start iocontrol.0.tool-change => parport.1.pin-?-out
> (to send a signal to arduino to start cycle gets turned on when M6 is
> executed)
> 
> System is paused at M6 until....below
> 
> net tool-change-done parport.1.pin-?-in => iocontrol.0.tool-changed
> (to send signal from arduino to emc that cycle is complete) EMC
> continues....

Seems reasonable, but if the Arduino is going to handle the change
logic, you don't need a .comp or ClassicLadder, just the two lines above
and pass the pocket number.

> net tnum-current iocontrol.0.tool-number => classicladder.0.s32in-00
> (Ladder will get tool number from this)
> 
> My ladder will look something like this:
> 
> --[compare %IWO = 1]-----------------------(%Q1)-  N.O. Coil linked to
> parport pin
> 
>                                          |-(/%Q2)- N.C. Coil linked to
> parport pin
> 
>                                          |-(/%Q3)- N.C. Could linked
> to parport pin
> 
> 
> --[compare %IWO = 2]-----------------------(%/Q1)-  N.C. Coil linked
> to parport pin
> 
>                                          |-(%Q2)- N.O. Coil linked to
> parport pin
> 
>                                          |-(/%Q3)- N.C. Could linked
> to parport pin
> 
> 
> etc...........
> 
> 
> Does this make sense?
> 
> 
> Thanks,
> 
> Mike

I don't think you need CL if you put a binary coded pocket number on a
few parallel port pins. Three pins can handle seven or eight pockets:
000 = 0, 001 = 1, 010 = 2, 011 = 3, 100 = 4 ... 111 = 7

You will need enough Aurduino input pins. 

My .hal file handles the conversion from pocket number to port pins
(Pico UPC controller pins) with this:
"
# decode turret encoder inputs
newsig ones bit
newsig twos bit
newsig fours bit
newsig eights bit

linksp ones ppmc.0.din.06.in
linksp ones wsum.0.bit.0.in
linksp twos ppmc.0.din.07.in
linksp twos wsum.0.bit.1.in
linksp fours ppmc.0.din.08.in
linksp fours wsum.0.bit.2.in
linksp eights ppmc.0.din.09.in
linksp eights wsum.0.bit.3.in
# wsum.N.hold bit in

newsig TurretCurrentPosition s32
linksp TurretCurrentPosition wsum.0.sum
linksp TurretCurrentPosition turret.0.position-current

newsig TurretRequestedPosition s32
linksp TurretRequestedPosition iocontrol.0.tool-prep-number
linksp TurretRequestedPosition turret.0.position-requested
"

This gets my pocket encoder number into my turret.comp . You will need
to go the other way and go from a number and convert to parport pins,
but the method could be the same.

So I think, the Ardiuno physical pins are:
1 -> tool change request
2 -> ones bit
3 -> twos bit
4 -> fours bit (and more bits if needed)
5 <- change done
6 <- fault
 (and maybe other signals)

Program the Arduino to do the change, then do the logical connections to
EMC2's iocontrol change/changed, tool requested, e-stop chain, etcetera,
in your .hal file.(?)

Of course, an EMC2 comp could replace the Aurduino, so EMC2 would not be
sitting idle during the tool change. (Too many options sometimes :)

-- 
Kirk Wallace
http://www.wallacecompany.com/machine_shop/
http://www.wallacecompany.com/E45/index.html
California, USA


------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to