On Sunday 24 May 2020 19:15:22 R C wrote: > Hello, > > > I have been following this thread. I wrote some code that runs on an > RPI that can read a quadrature encoder, I have a few of them, with > different resolutions. > > I also have a few encoders that came with some stepper motors I got my > hands on, still have to play with those to see what it is they exactly > do. > > > I saw this thread about "HAL programming", I don't know much about > linux-cnc/HAL, if anything, but is there some "general" interface so > one could 'feed' linux cnc > > data from an encoder? > > > I started playing/messing with these things, because it seems that > linux-cnc has a hard time keeping up with these encoders and there's > not a whole lot I could find
Most of that hard time is in the bob's, You can't buy one that is all ttl and therefore fast enough to keep up with a decent fine grained encoder on a spindle that might peak at 3k rpms. So if using a $20 bob, it comes with opto's on its inputs. You can throw lots a money at it, or rip out the opto's. I am a CET, so tracing the card and ripping out the opto's is my choice as all it costs me is the time. cnc4pc used to have a fancy bob (C1G rev-4, not rev-3) that worked well, but with all its bells and whistles it was 80 bucks. Now I "fix" the SainSmart bob. They at least give you visible input status even when fixed. > about how to make a spindle encoder work with linux cnc > > > Ron > > On 5/24/20 3:41 PM, John Dammeyer wrote: > > The > > http://linuxcnc.org/docs/html/examples/spindle.html#_spindle_feedbac > >k 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? > > > > 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? > > > > 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 > > _______________________________________________ > 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