Ian W. Wright wrote: > Hi John, > > I have now read through all the HAL documentation that I could find on > the EMC2 site and I'm still confused..... > > In 'stepgen step_types' I can't work out whether I would need to specify > type 0 or type 1 ( I originally thought 1 but then saw something that > says this has two outputs and I only want to control the stepper via a > normal step/direction driver board). >
http://www.linuxcnc.org/docview/html//hal_rtcomps.html#sec:Stepgen first sentence in section 1.1.5: "The step generator supports 15 different “step types”. Step type 0 is the most familiar, standard step and direction." You say you have a step/direction board, so use type 0. > Looking in stepper_xyza.hal file.... > > I realise that I will have to add 'ctrl_type = p,p,p,v' to the end of > the 'loadrt stepgen step_type' line to make the 4th axis a velocity one. Right - this assumes that you only want to use that axis as a spindle drive. More on this below.... > in '# hook its functions to realtime threads' do I need to add anything > else - I see it has a 'make.pulses base-thread' and various > servo-related threads (are these actually needed for stepper motor > machines?). The naming of the "servo" thread in EMC is for historical reasons - even stepper machines have a servo thread. You do not need to change anything in that area. > In the next two sections '# connect position commands from motion module > to step generator' and '# connect position feedback from step > generators' am I right in thinking that I should change the several > 'Apos - cmd' and 'Apos - fd' to 'Avel - cmd' and 'Avel - fb' respectively? I can't tell you what you need to do because you have not clearly stated your goals. You can't simply change "pos" to "vel" and have everything work. Going back to your original message, you wrote: >>> I have added a little lathe to my mini-mill which I want to >>> act both as an 'A' axis or an independent lathe. You haven't described in detail how you want that to work. For a lathe, you start the spindle by issuing "M3S1500" (for 1500 RPM). Once it is started, you can change speed by issuing another S command - S500 will change to 500 RPM. M5 stops the spindle. These M codes have absolutely nothing to do with position control of an A axis. For a mill with an A axis, the work is rotated using A axis position commands such as "G0 A90", or "G1 F30 A180". The spindle control codes M3, M5, etc, control the milling spindle holding the cutting tool, not the chuck holding the workpiece. Since lathe and mill do completely different things when you issue an M3 command, you have to decide how to chose which mode you are in. By far the simplest approach would be to have two independent EMC configurations, one for milling and one for lathe work. Simply choose the appropriate one when you start EMC. For the mill configuration, you should start with stepper_xyza, and make only whatever changes are needed for your specific setup. For the lathe configuration, you should start with a lathe sample, and then add one additional step generator in velocity mode to run the spindle. Since it is running a spindle, not an A axis, there will be no Apos _or_ Avel. Instead, you will hook the stepgen to various spindle related HAL pins as described here: http://www.linuxcnc.org/docview/html//config_emc2hal.html#r1_1_1 > After these I can't see anything else that looks as though it needs > modifying - am I missing something? I can't tell, because I don't know your goals. > I looked for info on 'limit2' but what I found didn't mean zip to me - > do I really need to worry about this or will MAXVEL and MAXACCEL take > care of everything? The stepgen block does contain internal ramping, so you don't need a limit block - I forgot about that when I wrote my first reply. You must of course set the maximum ramp rate. Something like "setp stepgen.2.maxaccel 700". I'm going to assume that you are using two separate configs for lathe and mill work. For lathe work, the simplest approach would be to set the spindle stepgen scaling such that a "position unit" is 1/60 of a revolution. Since the velocity input is scaled to "position units per second", if a unit is 1/60 of a revolution, then the input scaling works out to "revolutions per minute", which is what comes out of EMC's motion.spindle-speed-out pin. > By experiment I have found that the maximum speed I > can get out of the lathe spindle with the stepper I have attached is > 1400RPM which, with a 200 step stepper and 1/8 stepping driver is > 2240000 steps per minute. It does need ramping up to this speed though > over maybe 2 seconds. 2240000 steps/minute works out to 37,333 steps/second. That is high for software generated steps, but not impossible. In my first reply I wrote: "Is there any reason you aren't just letting EMC generate the pulses for both A-axis and spindle mode? Do you need a hardware step generator because software step pulses aren't fast enough for lathe mode?" In this case, the answer is "maybe". Since trying it doesn't cost anything, go for it. If you find that you can't get good lathe spindle performance, then go to a hardware step generator. > I'd be very grateful for any other help you could give me on this, > particularly as one of my driver boards has gone down and I'm having > problems getting the supplier to repair it. If I can shuffle the > remaining boards I have and get this driving method working, I could get > the whole thing up and working again and start to clear my backlog....... The whole idea of using the same motor for lathe spindle and A-axis seems a bit risky to me, given the dramatic differences in speed and torque requirements for those two applications. Usually, rotary tables use worm gears to greatly reduce speed and increase torque for positioning. Lathe mode requires less torque and more speed, and therefore would use direct drive. Commercial machines that use the same spindle for both A-axis and lathe work usually have a mechanical arrangement that clutches a slow but strong positioning drivetrain to the shaft of a weak but fast spindle drivetrain. Regards, John Kasunich ------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
