Machinekit Documentation

HAL Component — MUX16


All instantiable components can be loaded in two manners

Using loadrt with or without count= | names= parameters as per legacy components
Using newinst, which names the instance and allows further parameters and arguments
primarily pincount= which can set the number of pins created for that instance (where applicable)


mux16 — Select from one of sixteen input values




loadrt mux16
newinst mux16 <newinstname> [ pincount=N | iprefix=prefix ] [instanceparamX=X | argX=X ]

( args in [ ] denote possible args and parameters, may not be used in all components )


pin in bit use_graycode This signifies the input will use Gray code instead of binary. Gray code is a good choice when using physical switches because for each increment only one select input changes at a time.

pin in bit suppress_no_input This suppresses changing the output if all select lines are false. This stops unwanted jumps in output between transitions of input. but make in00 unavaliable.

pin in float debounce_time sets debouce time in seconds. eg. .10 = a tenth of a second input must be stable this long before outputs changes. This helps to ignore 'noisy' switches.

pin in bit sel#[4] Together, these determine which \fBin\fIN\fR value is copied to \fBout\fR.

pin out float out_f pin out s32 out_s Follows the value of one of the \fBin\fIN\fR values according to the four \fBsel\fR values and whether use-graycode is active.

The s32 value will be trunuated and limited to the max and min values of signed values. .RS .TP \fBsel3=false\fR, \fBsel2=false\fR, \fBsel1=false\fR, \fBsel0=false\fR \fBout\fR follows \fBin0\fR .TP \fBsel3=false\fR, \fBsel2=false\fR, \fBsel1=false\fR, \fBsel0=true\fR \fBout\fR follows \fBin1\fR .TP etc. .RE


mux16.N.funct ( OR <newinstname>.funct (requires a floating-point thread) )


mux16.N.use-graycode bit in ( OR <newinstname>.use-graycode bit in )

mux16.N.suppress-no-input bit in ( OR <newinstname>.suppress-no-input bit in )

mux16.N.debounce-time float in ( OR <newinstname>.debounce-time float in )

mux16.N.sel%01d bit in (M=0..4) ( OR <newinstname>.sel%01d bit in (M=0..4) )

mux16.N.out-f float out ( OR <newinstname>.out-f float out )

mux16.N.out-s s32 out ( OR <newinstname>.out-s s32 out )

mux16.N.elapsed float out ( OR <newinstname>.elapsed float out ) - Current value of the internal debounce timer for debugging.

mux16.N.selected s32 out ( OR <newinstname>.selected s32 out ) - Current value of the internal selection variable after conversion for debugging float in (MM=00..16) ( OR <newinstname>.in%02d float in (MM=00..16) ) - array of selectable outputs