On 4 July 2012 15:00, Kasey Matejcek <someo...@lkm.bz> wrote: > I want to be able to turn down the part then change the tool to drimal type > cutter tool and cut a pattern into the peace with one gcode file > > Is this possible?
It is possible. It isn't especially easy. It is probably easier with servos than with steppers though. The solution is probably to have two separate PID controllers in the HAL file, one taking a command from axis.3.motor-position-cmd and one taking an input from motion.spindle-speed-out (pin names from memory, not from the docs). You would then use a mux2 HAL component to send one or other of the PID outputs to the PWM generator. You could switch the mux2 on the basis of motion.spindle-on. Then M3 / M4 would disable A-axis control. The main complication to this simple scheme is that the A-axis PID will try to unwind all the lathe-mode rotations when you switch to lathe-mode. To counteract this you would need to force the encoder.N.index-enable pin high when the mode changes. This will take a slightly complex array of HAL functions, an edge-detector (HAL "oneshot") to set the index, and a HAL "tristate_bit" to set the encoder index-enable. You would probably (this is untested) simply setp the tristate-bit.0.in to 1, and net the oneshot output to tristate-bit.0.enable. The behaviour would then be that the axis would move in A-word control until an M3 or M4, at which point the mux would direct the speed PID to the PWM generator. On M5 the mux would switch to the old A-axis position control, the oneshot would trigger, loading a "true" to the encoder.N.index-enable pin. Because the spindle is many turns away from it's required position the A-axis PID controller will be maxed out, so the spindle will do at least one turn past the index. When it passes the index the encoder counts will go to zero, the PID will no longer be saturated, and the spindle should return to the last commanded angular position. http://www.linuxcnc.org/docs/html/hal/intro.html http://www.linuxcnc.org/docs/html/man/man9/mux2.9.html http://www.linuxcnc.org/docs/html/man/man9/oneshot.9.html http://www.linuxcnc.org/docs/html/man/man9/tristate_bit.9.html -- atp If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users