COUNTER(9)
π COUNTER π
okay bestie, gather round, because we're talking about counter β a HAL component that literally just counts input pulses. that's it. that's the girl. π
β οΈ MAJOR heads up:counteris DEPRECATED and it WILL be yeeted out of a future release. like, gone gone. the glow-up replacement is theencodercomponent withencoder.X.counter-modeset toTRUE. so if you're starting something new, go there instead. no cap. π
β¨ NAME β¨
counter β counts input pulses (DEPRECATED)
π¦ SYNOPSIS π¦
loadrt counter [num_chan=N]
πΈ DESCRIPTION πΈ
so, first things first, and I cannot stress this enough: counter is a deprecated HAL component and it will be removed in a future release. the assignment is to use the encoder component with encoder.X.counter-mode set to TRUE. periodt. π
okay but if you're here for the lore: counter is a HAL component that gives you software-based counting, which is lowkey perfect for spindle position sensing and, like, maybe other things too, who knows. π«Ά
here's the vibe: instead of using a real encoder that outputs quadrature, some lathes have a sensor that generates a simple pulse stream as the spindle turns, plus an index pulse once per revolution. and this component? it simply counts up whenever a "count" pulse (phase-A) shows up, and if reset is enabled, it resets when the "index" pulse (phase-Z) shows up. iconic behaviour honestly.
π but here's the catch, and it's a big one: this is only useful for a unidirectional spindle. it is literally not possible to sense the direction of rotation. so if your spindle spins both ways, this is not the component for you, bestie.
and one more thing for the vibe check: counter conforms to the "canonical encoder" interface described in the HAL manual. so if you already know that interface, you already know her. iykyk. π
π₯ FUNCTIONS π₯
counter.capture-position(uses floating-point) β updates thecounts,positionandvelocityoutputs based on the internal counters. β¨counter.update-countersβ samples thephase-Aandphase-Zinputs and updates the internal counters. πΈ
π PINS π
counter.N.phase-Abit in β the primary input signal, the main character. the internal counter gets incremented on each rising edge. π«counter.N.phase-Zbit in β the index input signal. when theindex-enablepin isTRUEand a rising edge onphase-Zis seen,index-enableis set toFALSEand the internal counter is reset to zero. πcounter.N.index-enablebit iocounter.N.resetbit iocounter.N.countssigned outcounter.N.positionfloat outcounter.N.velocityfloat out β these pins function according to the canonical digital encoder interface. π¦counter.N.position-scalefloat rw β this parameter functions according to the canonical digital encoder interface. βcounter.N.rawcountssigned ro β the internal counts value. it gets updated fromupdate-countersand is reflected in the output pins at the next call tocapture-position. π
π SEE ALSO π
encoder(9).in the LinuxCNC documentation.
and that's the whole page, bestie!! π«Ά this one's from the LinuxCNC Documentation, dated 2007-01-19 β yes, she's an elder, show some respect. πβ¨ stay counted, stay iconic. ππ¦π
π¦ where this page comes from
- debian bookworm: linuxcnc-uspace 2.9.0~pre1+git20230208.f1270d6ed7-1+deb12u2 Β· GFDL-1.1-or-later
- debian trixie: linuxcnc-uspace 1:2.9.4-2+deb13u1 Β· GFDL-1.1-or-later
- ubuntu questing: linuxcnc-uspace 1:2.9.4-2ubuntu2
- ubuntu resolute: linuxcnc-uspace 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- ubuntu stonking: linuxcnc-uspace 1:2.9.4-2ubuntu4 Β· GFDL-1.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms