On Wed, 2008-09-17 at 20:36 +0100, Simon Daykin wrote: > I have been searching but can't seem to find much information on how to do > toolchanger macros in EMC. > > My toolchanger uses a rotary axis to index round to a position and then > reverse the drive to lock it into position. I should be able to write a > macro to do it but I can't find much information or examples. > > Can someone point me at some information please. > > Thanks > Simon
It seems to me that all that is needed is a means to output the signals for one position change, then run it the number of times needed to get to the requested tool. I assume you have an existing stepper driver that uses step/direction or quadrature signals for input. These signals could be created by a pair of loop routines in a 160TCL.comp HAL component. The forward loop would execute a set number of times to rotate the holder to just beyond the next X positions (X = requested tool - current tool, with wrap compensation) and would output step/dir or A, B to a pair of parport pins. Then a park loop would reverse step to park the tool holder. I believe the current tool number is stored in the XXX.var file? (I can't seem to find a link to the table that lists the var file entries) So, the current tool is saved across EMC2 starts. I would make it part of the EMC2 start-up routine to set the actual current tool number to the stored current tool number. The 160TCL.comp logic might be like this: forward loops = requested tool - current tool tool change forward direction(set direction low) forward loop(number of forward loops) ^ step loop(number of steps for one tool position change) | ^ step output=high | | (time delay?) | | step output=low | | (time delay?) | step loop forward loop park reverse direction(set direction high) step loop(number of steps for park) ^ step output=high | (time delay?) | step output=low | (time delay?) step Loop exit Personally, I would fit an eight position encoder like on my HNC: http://www.wallacecompany.com/cnc_lathe/HNC/00025-1a.jpg http://www.wallacecompany.com/cnc_lathe/HNC/ This would be cheap and fairly easy to make using Hall sensors and a priority encoder: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=296-3533-5-ND http://focus.ti.com/lit/ds/symlink/cd4532b.pdf http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=US5881EUA-ND http://www.melexis.com/prodfiles/0003715_hallapps.pdf Then use Chris' Ladder, or my HAL component setup. Then the tool position will be verified for each tool change. -- Kirk Wallace (California, USA http://www.wallacecompany.com/machine_shop/ Hardinge HNC/EMC CNC lathe, Bridgeport mill conversion, doing XY now, Zubal lathe conversion pending Craftsman AA 109 restoration Shizuoka ST-N/EMC CNC) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users