On Sunday 24 May 2020 17:41:33 John Dammeyer wrote: > The > http://linuxcnc.org/docs/html/examples/spindle.html#_spindle_feedback > document lists this example code with a footnote on the use of > encoder.3 > > "In this example, we will assume that some encoders have already been > issued to axes/joints 0, 1, and 2. So the next encoder available for > us to attach to the spindle would be number 3. Your situation may > differ. " > > The document isn't clear to me on this. If I do not have encoders > issued for axes/joints 0,1,2 then can the spindle use encoer.0? Or > are those numbers reserved for the existing axis anyway? Which I > guess doesn't make sense because then there would also have to be > encoders for axis a,b & c and the spindle would start at 6. I've > probably answered my own question. > > But if the spindle encoder is declared in the hal file first, as > encoder.0, does that make x,y & z then encoder.1, encoder.2 and > encoder.3?
You can AFIAK, use them in any order in the hal file. Same with steppers, or pwm-gen's, the hal file can assign them in any order. Mesa may demand no missing numbers to work correctly, but I doubt it. > Or by default if encoders are used with x,y &z are they then by > default 0,1 & 2? And even if declared in the hal file in a different > order must be allocated as 0, 1 & 2? "Default use order" is generally up to the coder writing the hal file. Totally arbitrary order IOW. > Enquiring minds need to know. > Thanks > John > > > # add the encoder to HAL and attach it to threads. > loadrt encoder num_chan=1 > addf encoder.update-counters base-thread > addf encoder.capture-position servo-thread > > # set the HAL encoder to 100 pulses per revolution. > setp encoder.3.position-scale 100 > > # set the HAL encoder to non-quadrature simple counting using A only. > setp encoder.3.counter-mode true > > # connect the HAL encoder outputs to LinuxCNC. > net spindle-position encoder.3.position => motion.spindle-revs > net spindle-velocity encoder.3.velocity => motion.spindle-speed-in > net spindle-index-enable encoder.3.index-enable <=> > motion.spindle-index-enable > > # connect the HAL encoder inputs to the real encoder. > net spindle-phase-a encoder.3.phase-A <= parport.0.pin-10-in > net spindle-phase-b encoder.3.phase-B > net spindle-index encoder.3.phase-Z <= parport.0.pin-11-in > > > > > > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) If we desire respect for the law, we must first make the law respectable. - Louis D. Brandeis Genes Web page <http://geneslinuxbox.net:6309/gene> _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users