ENUM(9)
π ENUM(9) π
okay bestie, sit DOWN, because this is enum, a LinuxCNC manpage, and it's literally the most group-chat-coded little component ever. it takes integers and turns them into bits, and it takes bits and turns them back into integers. it's giving translator. it's giving bilingual icon. π
β¨ NAME β¨
enum β enumerate integer values into bits π¦
πΈ SYNOPSIS πΈ
loadrt enum
enums=E;enum1pin1;enum1pin2;;;enum1pin3,D;;;enum2pin1;enum2pin2
[names=name1,name2]
π DESCRIPTION π
so like, enum converts integer values into bits and vice versa. that's the whole vibe. bidirectional queen. π
the component is especially suitable for encoding and decoding register values for modbus devices, where control commands and status are frequently encoded as enumerations rather than bits. for example 0 = stop, 1 = forwards, 2 = backwards, 3 = jog-forwards etc. see? a little integer doing so much emotional labor. π
the pins created, and the behaviour of the component, are controlled by the load-time modparams enums= and names=. those two are the puppet masters. the main characters, if you will.
the enums= parameter should be a comma-separated list of semicolon-separated pin labels. the enumerated values will increase in sequence starting at zero. to skip a value use a zero-length label, ie two consecutive semicolons, as shown in the examples. (yes bestie, the empty slot is on purpose. it's the gap in the friendship group. π«Ά)
there should be no spaces in the enums= list. none. not one. i'm so serious. π
names= is an optional list of component instance names. if names= is omitted the functions and pins will be named enum-decode.... or enum-encode....
taking the example configuration above, if enum-decode.01.enum2pin1-in is set to TRUE then the output pin enum-decode.01.output will be set to the value 2. if enum-decode.01.enum2pin2-in is set to true then the output would be 3. see how that escalates? 2, then 3. growth. π
conversely, if enum-encode.00.input is set to 4 then the pin enum-encode.00.enum1pin3-out will be set to TRUE. and that's the reverse pipeline, slay. β¨
π OPTIONS π
listen, this part is the control codes, and they go preceding the list of labels:
Dβ decode. a D-type enum will set the value of HAL bit pins in response to changes to theenum-decode.NN.inputvalue.Eβ encode. an E-type enum will set the value of theenum-encode.NN.outputinteger depending on whichenum-encode.NN.label-bitvalue is set.
if more than one label-bit input pin is set the output value will correspond to the pin label later in the list. (last one wins, basically. it's giving main character energy at the end of the semicolon list. π)
E and D-type enumerations may be freely mixed in separate instances. they coexist. they don't have beef. periodt.
π¦ FUNCTIONS π¦
enum-decode.NNβ if instance type ="D"enum-encode.NNβ if instance type ="E"
that's it. two moods. pick your fighter. π
β PINS β
enum-decode.NN.inputβ the integer value to be decodedenum-decode.NN.label-outβ output bits of a decode instanceenum-decode.NN.label-valβ the enumeration value corresponding to each specific bit output. these are populated in sequence during loading but may be over-ridden in HAL if convenient.enum-encode.NN.label-inβ input bits of a decode instanceenum-encode.NN.label-valβ the enumeration value corresponding to each specified bit input. these are populated in sequence during loading but may be over-ridden in HAL if convenient.enum-decode.NN.outputβ the integer value corresponding to the set bit input.
ngl the sheer number of pins here is a lot, but they're all doing their little jobs and honestly? we respect them. π
π BUGS π
if no bits are set the output value will be zero even if zero is a defined enumeration.
okay so that's the cursed part. zero is the void value whether or not you asked for zero. the enum said "default state: nothing." not me getting philosophical about a HAL component. π
πΈ AUTHOR πΈ
Andy Pugh
π REPORTING BUGS π
report bugs to at the LinuxCNC github issues list:
https://github.com/LinuxCNC/linuxcnc/issues
π COPYRIGHT π
Copyright Β© 2023 Andy Pugh. this is free software; see the source for copying conditions. there is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
and that's the whole page, bestie!! this lil writeup lives under the LinuxCNC name, dated 03/17/2026, and it's filed as ENUM(9) β so when you're deep in the man pages at 2am, iykyk. go forth and encode. π§πβ¨
π¦ where this page comes from
- 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