On 30 September 2010 16:15, sam sokolik <sa...@empirescreen.com> wrote: > > Maybe you could use what andy did with his gear hobbing?
It does sound like a very similar approach. If you consider my spindle encoder to be your MPG, and your spindle to be my workholder axis, then it is actually as simple as hooking up the encoder counter position output to the input of the spindle position PID control. I would then have a PyVCP panel with a textbox for thread pitch, and a button that calls a subroutine (via MDI_COMMAND) which reads the pitch and performs a G33 move at the specified pitch. Of course, this might not work. My fear is that the G33 would either never "complete" if you wound out before the programmed Z destination, or would stop at the programmed Z and not back out again. In that case you would need to interpose an add and a scale function in the HAL between the Z pos-cmd and the Z-axis motor controller. This would add on a proportion of the C axis position (governed by the thread pitch pyvcp box) to the Z command position. A _serious_ "Gotcha" here is that if there is any significant value in the C axis position encoder value (and there generally will be) any time you change the thread pitch the Z will shoot to a new position. This is likely to be very bad.... The way round this is to use a sample-and-hold that stores the current C-axis position any time the thread-pitch box value changes. This value is subtracted from the C-position before it is added in to the Z position arithmetic. I had to do exactly this with my hobbing HAL. I used a diff with an abs and an edge detector to trigger the sample and hold. The sample-and-hold is actually a mux2, as the sample-and-hold module is the wrong datatype. The "True" input was wired to the encoder output, and the "false" input was wired to the output, which converts the mux2 to a sample-and hold. Simples! -- atp ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users