\# Author Andy Pugh \# Issued under the terms of the GPL v2 License or any later version .TH MUX_GENERIC "9" "2013-05-27" "LinuxCNC Documentation" "HAL Component" .de TQ .br .ns .TP \\$1 .. .SH NAME mux_generic \- choose one from several input values .SH SYNOPSIS .HP .B loadrt mux_generic config="bb8,fu12...." .SH FUNCTIONS .TP \fBmux-gen.\fINN\fB\fR Depending on the data types can run in either a floating point or non-floating point thread. .SH PINS .TP .B mux-gen.\fINN\fB.suppress-no-input\fR bit in \fR This suppresses changing the output if all select lines are false. This stops unwanted jumps in output between transitions of input. but makes in00 unavaliable. .TP .B mux-gen.\fINN\fB.debounce-us\fR unsigned in \fR sets debouce time in microseconds. eg. 100000 = a tenth of a second. The selection inputs must be stable this long before the output changes. This helps to ignore 'noisy' switches. .TP .B mux-gen.\fINN\fB.sel-bit\fIMMM\fB\fR bit in (M=0..N) \fR .TP .B mux-gen.\fINN\fB.sel-int\fIMMM\fB\fR unsigned in \fR Together, these determine which \fBin\fIN\fR value is copied to \fBoutput\fR. The bit pins are interpreted as binary bits, and the result is simply added on to the integer pin input. It is expected that eoither one or the other would normally be used. Hower, the possibility exists to use a higher-order bit to "shift" the values set by the integer pin. The sel-bit pins are only created when the size of the mux_gen component is an integer power of two. This component (unlike mux16) does not offer the option of decoding gray-code, however the same effect can be achieved by arranging the order of the input values to suit. .TP .B mux-gen.\fINN\fB.out-[bit/float/s32/u32]\fR variable-type out \fR Follows the value of one of the \fBin\fIN\fR values according to the selection bits and/or the selection number. Values will be converted/truncated according to standard C rules. This means, for example that a float input greater than 2147483647 will give an S32 output of -2147483648. .TP .B mux-gen.\fINN\fB.in-[bit/float/s32/u32]-\fIMM\fB\fR variable-type in\fR The possible output values that are selected by the selection pins. .SH PARAMETERS .TP .B mux-gen.\fIN\fB.elapsed\fR float r \fR Current value of the internal debounce timer for debugging. .TP .B mux-gen.\fIN\fB.selected\fR s32 r \fR Current value of the internal selection variable after conversion for debugging. Possibly useful for setting up gray-code switches. .SH DESCRIPTION This component is a more general version of the other multiplexing components. It allows the creation of arbitrary-size multiplexers (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 mux and a 12-element float-to-unsigned mux. The code letters are b = bit, f = float, s = signed integer, u = 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 float value will be converted to a "true" output in bit form. Be wary that float datatypes can be very, very, close to zero and not actually be equal to zero. Each mux has its own HAL function and must be added to a thread separately. If neither input nor output is of type float then the function is base-thread (non floating-point) safe. Any mux_generic with a floating point input or output can only be added to a floating-point thread. .SH LICENSE GPL .SH AUTHOR Andy Pugh