11[[cha:spindle-control]]
22
3+ LinuxCNC can control up to 8 spindles. The number is set in the INI file.
4+ The examples below all refer to a single-spindle config with spindle
5+ control pins with names like spindle.0...
6+ In the case of a multiple spindle machine all that changes is that
7+ additional pins exist with names such as spindle.6...
8+
39= Spindle Control
410
511(((0-10v Spindle Speed Example)))
@@ -24,7 +30,7 @@ card does not do scaling.
2430loadrt scale count=1
2531addf scale.0 servo-thread
2632setp scale.0.gain 0.002
27- net spindle-speed-scale spindle.N .speed-out => scale.0.in
33+ net spindle-speed-scale spindle.0 .speed-out => scale.0.in
2834net spindle-speed-DAC scale.0.out => <your DAC pin name>
2935----
3036
@@ -39,8 +45,8 @@ use the pwmgen component to create the signal:
3945loadrt pwmgen output_type=0
4046addf pwmgen.update servo-thread
4147addf pwmgen.make-pulses base-thread
42- net spindle-speed-cmd spindle.N .speed-out => pwmgen.0.value
43- net spindle-on spindle.N .on => pwmgen.0.enable
48+ net spindle-speed-cmd spindle.0 .speed-out => pwmgen.0.value
49+ net spindle-on spindle.0 .on => pwmgen.0.enable
4450net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out
4551# Set the spindle's top speed in RPM
4652setp pwmgen.0.scale 1800
@@ -56,7 +62,7 @@ nist-lathe sample configuration to use a scale component.
5662== Spindle Enable
5763
5864If you need a spindle enable signal,
59- link your output pin to spindle.N .on.
65+ link your output pin to spindle.0 .on.
6066To link these pins to a parallel port pin put something like
6167the following in your .hal file, making sure you pick the
6268pin that is connected to your control device.
@@ -79,8 +85,8 @@ following in your .hal file making sure you pick the pin that is
7985connected to your control device.
8086
8187----
82- net spindle-fwd spindle.N .forward => parport.0.pin-16-out
83- net spindle-rev spindle.N .reverse => parport.0.pin-17-out
88+ net spindle-fwd spindle.0 .forward => parport.0.pin-16-out
89+ net spindle-rev spindle.0 .reverse => parport.0.pin-17-out
8490----
8591
8692(((Spindle Soft Start Example)))
@@ -96,7 +102,7 @@ second part is to let LinuxCNC know when the spindle is at speed so motion
96102can begin.
97103
98104In the 0-10 volt example the line
99- 'net spindle-speed-scale spindle.N .speed-out => scale.0.in'
105+ 'net spindle-speed-scale spindle.0 .speed-out => scale.0.in'
100106is changed as shown in the following example:
101107
102108.Intro to HAL components limit2 and near:
@@ -130,7 +136,7 @@ addf spindle-at-speed servo-thread
130136setp spindle-ramp.maxv 60
131137
132138# hijack the spindle speed out and send it to spindle ramp in
133- net spindle-cmd <= spindle.N .speed-out => spindle-ramp.in
139+ net spindle-cmd <= spindle.0 .speed-out => spindle-ramp.in
134140
135141# the output of spindle ramp is sent to the scale in
136142net spindle-ramped <= spindle-ramp.out => scale.0.in
@@ -142,9 +148,9 @@ net spindle-ramped <= spindle-ramp.out => scale.0.in
142148net spindle-cmd => spindle-at-speed.in1
143149net spindle-ramped => spindle-at-speed.in2
144150
145- # the output from spindle-at-speed is sent to spindle.N .at-speed
151+ # the output from spindle-at-speed is sent to spindle.0 .at-speed
146152# and when this is true motion will start
147- net spindle-ready <= spindle-at-speed.out => spindle.N .at-speed
153+ net spindle-ready <= spindle-at-speed.out => spindle.0 .at-speed
148154----
149155
150156== Spindle Feedback
@@ -154,9 +160,14 @@ net spindle-ready <= spindle-at-speed.out => spindle.N.at-speed
154160=== Spindle Synchronized Motion
155161
156162Spindle feedback is needed by LinuxCNC to perform any spindle coordinated
157- motions like threading and constant surface speed. The StepConf Wizard
158- can perform the connections for you if you select Encoder Phase A and
159- Encoder Index as inputs.
163+ motions like threading and constant surface speed.
164+ LinuxCNC can perform synchronised motion and CSS with any of up to 8
165+ spindles. Which spindles are used is controlled from G-code. CSS is
166+ possible with several spindles simultaneously.
167+
168+ The StepConf Wizard can perform the connections for a single-spindle
169+ configuration for you if you select Encoder Phase A and Encoder Index as
170+ inputs.
160171
161172Hardware assumptions:
162173
@@ -189,8 +200,8 @@ setp encoder.3.position-scale 100
189200setp encoder.3.counter-mode true
190201
191202# connect the HAL encoder outputs to LinuxCNC.
192- net spindle-position encoder.3.position => spindle.N .revs
193- net spindle-velocity encoder.3.velocity => spindle.N .speed-in
203+ net spindle-position encoder.3.position => spindle.0 .revs
204+ net spindle-velocity encoder.3.velocity => spindle.0 .speed-in
194205net spindle-index-enable encoder.3.index-enable <=> spindle.N.index-enable
195206
196207# connect the HAL encoder inputs to the real encoder.
@@ -204,11 +215,11 @@ net spindle-index encoder.3.phase-Z <= parport.0.pin-11-in
204215=== Spindle At Speed
205216
206217To enable LinuxCNC to wait for the spindle to be at speed before executing
207- a series of moves you need to set spindle.N.at-speed to true when
218+ a series of moves. You need to set spindle.N.at-speed to true when
208219the spindle is at the commanded speed. To do this you need spindle
209220feedback from an encoder. Since the feedback and the commanded speed
210- are not usually 'exactly' the same you need to use the 'near'
211- component to say that the two numbers are close enough.
221+ are not usually 'exactly' the same you should to use the 'near'
222+ component to determine that the two numbers are close enough.
212223
213224The connections needed are from the spindle
214225velocity command signal to near.n.in1 and from the spindle velocity
@@ -235,7 +246,7 @@ net spindle-cmd => near.0.in1
235246net spindle-velocity => near.0.in2
236247
237248# connect the output to the spindle-at-speed input
238- net spindle-at-speed spindle.N .at-speed <= near.0.out
249+ net spindle-at-speed spindle.0 .at-speed <= near.0.out
239250
240251# set the spindle speed inputs to agree if within 1%
241252setp near.0.scale 1.01
0 commit comments