COUNTER(9)

πŸ“¦
version 2.9.4 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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: counter is DEPRECATED and it WILL be yeeted out of a future release. like, gone gone. the glow-up replacement is the encoder component with encoder.X.counter-mode set to TRUE. 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 the counts, position and velocity outputs based on the internal counters. ✨
  • counter.update-counters β€” samples the phase-A and phase-Z inputs and updates the internal counters. 🌸

πŸ‘‘ PINS πŸ‘‘

  • counter.N.phase-A bit in β€” the primary input signal, the main character. the internal counter gets incremented on each rising edge. πŸ’«
  • counter.N.phase-Z bit in β€” the index input signal. when the index-enable pin is TRUE and a rising edge on phase-Z is seen, index-enable is set to FALSE and the internal counter is reset to zero. πŸŽ€
  • counter.N.index-enable bit io
  • counter.N.reset bit io
  • counter.N.counts signed out
  • counter.N.position float out
  • counter.N.velocity float out β€” these pins function according to the canonical digital encoder interface. πŸ¦‹
  • counter.N.position-scale float rw β€” this parameter functions according to the canonical digital encoder interface. ⭐
  • counter.N.rawcounts signed ro β€” the internal counts value. it gets updated from update-counters and is reflected in the output pins at the next call to capture-position. πŸ™ˆ

πŸ’œ SEE ALSO πŸ’œ


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. πŸŽ€πŸ¦‹πŸ’