LinuxCNC Documentation

SYNOPSIS

loadrt demux_generic config="<input_type><output_type><size>[,<input_type><output_type><size>],…​"

Types: b = bool, f = real, s = sint, u = uint

Example: loadrt demux_generic config="bb8,fu12"

FUNCTIONS

demux-gen.NN Demultiplexer function.

PINS

            demux-gen.NN.sel-bit-00 ───────────────────┐
                                ... ─────────────────┐ │
            demux-gen.NN.sel-bit-BB ───────────────┐ │ │
               demux-gen.NN.sel-int ─────────────┐ │ │ │
                                         ┌───────┴─┴─┴─┴───────┐
                                         │          / o─────   ├───── demux-gen.NN.out-[bool/real/sint/uint]-00
demux-gen.NN.in-[bool/real/sint/uint] ───┤   ─────o   o─────   ├───── ...
                                         │            o─────   ├───── demux-gen.NN.out-[bool/real/sint/uint]-MM
     demux-gen.NN.suppress-no-input ─────┤                     │
           demux-gen.NN.debounce-us ─────┤                     │
                                         └─────────────────────┘
demux-gen.N.suppress-no-input bool in

This suppresses changing the output if all select lines are false. This stops unwanted jumps in output between transitions of input but makes in00 unavailable.

demux-gen.N.debounce-us uint in

sets debounce time in microseconds, e.g. 100000 = a tenth of a second. The selection inputs must be stable this long before the output changes. This helps to ignore noisy switches.

demux-gen.N.sel-bit-BB bool in (BB=0..bit width of size)
demux-gen.N.sel-int uint in

The sel-bit pins are only created when the size of the demux_gen component is an integer power of two. Together, these determine to which out-MM the in value is forwarded. The bit pins are interpreted as binary bits, and the result is simply added on to the integer pin input. It is expected that either one or the other would normally be used. However, the possibility exists to use a higher-order bit to "shift" the values set by the integer pin.

demux-gen.N.in-[bool/real/sint/uint] variable-type in

The input value which is routed to an output depending on the selection pins.

demux-gen.N.out--MM variable-type out (M=0..size-1)

According to the selection bits and/or the selection number, the selected output follows the in value. The other outputs retain the values they had before resp. zero if they have not been selected yet. Values will be converted and clamped. This means, for example that a REAL input greater than (approx.) 263-1 will give a SINT output of 263-1.

PARAMETERS

demux-gen.N.elapsed real r

Current value of the internal debounce timer for debugging.

demux-gen.N.selected sint r

Current value of the internal selection variable after conversion for debugging. Possibly useful for setting up gray-code switches.

DESCRIPTION

This component is a general demultiplexer component. It allows the creation of arbitrary-size demultiplexers (up to 1024 entries) and also supports differing data types on the input and output pins. The configuration string is a comma-separated list of code-letters and numbers, such as "bb4,fu12". This would create a 4-element bit-to-bit demux and a 12-element real-to-uint demux. The code letters are:

b = bool (boolean), f = real (floating point), s = sint (signed integer) and u = uint (unsigned integer).

The first letter code is the input type, the second is the output type. The codes are not case-sensitive. The order of the letters is significant but the position in the string is not. Do not insert any spaces in the config string. Any non-zero real value will be converted to a "true" output in bool form when it is more than ±2e-7 from zero.

Each demux has its own HAL function and must be added to a thread separately.

SEE ALSO

AUTHOR

Hans Unzner

LICENSE

GPL