#LyX 1.3 created this file. For more info see http://www.lyx.org/ \lyxformat 221 \textclass book \language english \inputencoding auto \fontscheme default \graphics default \paperfontsize default \spacing single \papersize Default \paperpackage a4 \use_geometry 0 \use_amsmath 0 \use_natbib 0 \use_numerical_citations 0 \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default \layout Chapter Spindle Control \layout Section 0-10v Spindle Speed \layout Standard If your spindle is controlled by a VFD with a 0 to 10 volt signal and your using a DAC card like the m5i20 to output the control signal. \layout Standard First you need to figure the scale of spindle speed to control signal. For this example the spindle top speed of 5000 RPM is equal to 10 volts. \begin_inset Formula $10/5000=0.002$ \end_inset so our scale factor is 0.002 \layout Standard We have to add a scale componet to the hal file to scale the motion.spindle-speed -out to the 0 to 10 needed by the VFD if your DAC card does not do scaling. \layout Standard loadrt scale count=1 \layout Standard addf scale.0 servo-thread \layout Standard setp scale.0.gain 0.002 \layout Standard net spindle-speed-scale motion.spindle-speed-out => scale.0.in \layout Standard net spindle-speed-DAC scale.0.out => \layout Section PWM Spindle Speed \layout Standard If your spindle can be controlled by a PWM signal, use the pwmgen component to create the signal: \layout Standard loadrt pwmgen output_type=0 \layout Standard addf pwmgen.update servo-thread \layout Standard addf pwmgen.make-pulses base-thread \layout Standard net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value \layout Standard net spindle-on motion.spindle-on => pwmgen.0.enable \layout Standard net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out \layout Standard setp pwmgen.0.scale 1800 # Change to your spindle's top speed in RPM \layout Standard This assumes that the spindle controller's response to PWM is simple: 0% PWM gives 0RPM, 10% PWM gives 180 RPM, etc. If there is a minimum PWM required to get the spindle to turn, follow the example in the nist-lathe sample configuration to use a scale component. \layout Section Spindle Feedback \layout Standard Add this section \layout Section Spindle Enable \layout Standard If you need a spindle enable signal link your output pin to motion.spindle-on. To link these pins to a parallel port pin put something like the following in your .hal file making sure you pick the pin that is connected to your control device. \layout Standard net spindle-enable motion.spindle-on => parport.0.pin-14-out \layout Section Spindle Direction \layout Standard If you have direction control of your spindle the hal pins motion.spindle-forward and motion.spindle-reverse are controlled by M3 and M4. S must be set to a positive non zero value for M3/4 to turn on spindle motion. \layout Standard To link these pins to a parallel port pin put something like the following in your .hal file making sure you pick the pin that is connected to your control device. \layout Standard net spindle-fwd motion.spindle-forward -> parport.0.pin-16-out \layout Standard net spindle-rev motion.spindle-reverse => parport.0.pin-17-out \the_end