Explaining mux_generic
15 Sep 2014 03:47 #51167
by Duc
Explaining mux_generic was created by Duc
Looking to update my system to use the mux_generic to take advantage of the increased tables. Coding is far from what I excel at.
Old sample code that I will need to increase from a 4 bit input to 5 input.
On the mux_generic how does one combine multiple mux_generic in the hal code?
I.E. mux_generic.1="bb4,fu15" or mux_generic_fo="bb4,fu15"?
For the above code would this be correct?
Once I get the pattern down I can increase the code to size easy.
Old sample code that I will need to increase from a 4 bit input to 5 input.
loadrt mux16 count=4
# --- Feedrate overide - FO-INCR-A ---
net fo-incr-a <= hm2_5i25.0.7i84.0.1.input-08
# --- FO-INCR-B ---
net fo-incr-b <= hm2_5i25.0.7i84.0.1.input-07
# --- FO-INCR-C ---
net fo-incr-c <= hm2_5i25.0.7i84.0.1.input-06
# --- FO-INCR-D ---
net fo-incr-d <= hm2_5i25.0.7i84.0.1.input-05
# connect feed overide increments - switches
setp halui.feed-override.count-enable true
setp halui.feed-override.direct-value true
setp halui.feed-override.scale .01
net feedoverride-incr => halui.feed-override.counts
net fo-incr-a => mux16.1.sel0
net fo-incr-b => mux16.1.sel1
net fo-incr-c => mux16.1.sel2
net fo-incr-d => mux16.1.sel3
net feedoverride-incr <= mux16.1.out-s
setp mux16.1.debounce-time 0.200000
setp mux16.1.use-graycode False
setp mux16.1.suppress-no-input False
setp mux16.1.in00 0.000000
setp mux16.1.in01 10.000000
setp mux16.1.in02 20.000000
setp mux16.1.in03 30.000000
setp mux16.1.in04 40.000000
setp mux16.1.in05 50.000000
setp mux16.1.in06 60.000000
setp mux16.1.in07 70.000000
setp mux16.1.in08 80.000000
setp mux16.1.in09 90.000000
setp mux16.1.in10 100.000000
setp mux16.1.in11 110.000000
setp mux16.1.in12 120.000000
setp mux16.1.in13 130.000000
setp mux16.1.in14 140.000000
setp mux16.1.in15 150.000000
On the mux_generic how does one combine multiple mux_generic in the hal code?
I.E. mux_generic.1="bb4,fu15" or mux_generic_fo="bb4,fu15"?
For the above code would this be correct?
mux_generic.1=="bb4,fu15"
# --- Feedrate overide - FO-INCR-A ---
net fo-incr-a <= hm2_5i25.0.7i84.0.1.input-08
# --- FO-INCR-B ---
net fo-incr-b <= hm2_5i25.0.7i84.0.1.input-07
# --- FO-INCR-C ---
net fo-incr-c <= hm2_5i25.0.7i84.0.1.input-06
# --- FO-INCR-D ---
net fo-incr-d <= hm2_5i25.0.7i84.0.1.input-05
# connect feed overide increments - switches
setp halui.feed-override.count-enable true
setp halui.feed-override.direct-value true
setp halui.feed-override.scale .01
net feedoverride-incr => halui.feed-override.counts
net fo-incr-a => mux_generic.1.1.sel0
net fo-incr-b => mux_generic.1.sel1
net fo-incr-c => mux_generic.1.sel2
net fo-incr-d => mux_generic.1.sel3
net feedoverride-incr <= mux_generic.1.out-s
setp mux_generic.1.debounce-time 0.200000
setp mux_generic.1.use-graycode False
setp mux_generic.1.suppress-no-input False
setp mux_generic.1.in00 0.000000
setp mux_generic.1.in01 10.000000
setp mux_generic.1.in02 20.000000
setp mux_generic.1.in03 30.000000
setp mux_generic.1.in04 40.000000
setp mux_generic.1.in05 50.000000
setp mux_generic.1.in06 60.000000
setp mux_generic.1.in07 70.000000
setp mux_generic.1.in08 80.000000
setp mux_generic.1.in09 90.000000
setp mux_generic.1.in10 100.000000
setp mux_generic.1.in11 110.000000
setp mux_generic.1.in12 120.000000
setp mux_generic.1.in13 130.000000
setp mux_generic.1.in14 140.000000
setp mux_generic.1.in15 150.000000
Once I get the pattern down I can increase the code to size easy.
Please Log in or Create an account to join the conversation.
15 Sep 2014 07:35 #51173
by andypugh
You configure the size and data type of the mux in the "loadrt" line. Once the mux is loaded it has a fixed configuration.
loadrt mux_generic config=bb4,fu15
It doesn't seem that mux_generic supports the "names=" option to configure the name. I will beat the author until he fixes that.
Replied by andypugh on topic Explaining mux_generic
On the mux_generic how does one combine multiple mux_generic in the hal code?
I.E. mux_generic.1="bb4,fu15" or mux_generic_fo="bb4,fu15"?
You configure the size and data type of the mux in the "loadrt" line. Once the mux is loaded it has a fixed configuration.
loadrt mux_generic config=bb4,fu15
It doesn't seem that mux_generic supports the "names=" option to configure the name. I will beat the author until he fixes that.
Please Log in or Create an account to join the conversation.
15 Sep 2014 08:33 #51177
by Duc
so at most mux_generic can only exist once in the hal file? Since there is no naming convention.
Replied by Duc on topic Explaining mux_generic
On the mux_generic how does one combine multiple mux_generic in the hal code?
I.E. mux_generic.1="bb4,fu15" or mux_generic_fo="bb4,fu15"?
You configure the size and data type of the mux in the "loadrt" line. Once the mux is loaded it has a fixed configuration.
loadrt mux_generic config=bb4,fu15
It doesn't seem that mux_generic supports the "names=" option to configure the name. I will beat the author until he fixes that.
so at most mux_generic can only exist once in the hal file? Since there is no naming convention.
Please Log in or Create an account to join the conversation.
15 Sep 2014 12:45 #51180
by cmorley
Replied by cmorley on topic Explaining mux_generic
loadrt mux_generic config="bs5,bs5"
would give you two muxes, with 5 bit input and s32 output
the pin names look like this:
mux-gen.00.in-bit-00
mux-gen.01.in-bit-00
mux generic doesn't have the gray code option so don't include that command
Andy if you fix the names= option, it would also be nice to have both the float and the s32 output pins available.
mux16 always has both out-s and out-f
I have come across situations where I have wanted to output to both types of pins at the same time.
In linuxcnc I wish we could connect s32 to float and vice versa directly.
Chris M
would give you two muxes, with 5 bit input and s32 output
the pin names look like this:
mux-gen.00.in-bit-00
mux-gen.01.in-bit-00
mux generic doesn't have the gray code option so don't include that command
Andy if you fix the names= option, it would also be nice to have both the float and the s32 output pins available.
mux16 always has both out-s and out-f
I have come across situations where I have wanted to output to both types of pins at the same time.
In linuxcnc I wish we could connect s32 to float and vice versa directly.
Chris M
Please Log in or Create an account to join the conversation.
15 Sep 2014 17:53 #51188
by andypugh
No, you can have as many as you want, but they get sequentially numbered names over which you have no control. The sample configs rarely use "names=", you might not even have noticed that the option exists as a default for comp-based components.
Replied by andypugh on topic Explaining mux_generic
so at most mux_generic can only exist once in the hal file? Since there is no naming convention.
No, you can have as many as you want, but they get sequentially numbered names over which you have no control. The sample configs rarely use "names=", you might not even have noticed that the option exists as a default for comp-based components.
Please Log in or Create an account to join the conversation.
15 Sep 2014 17:54 #51189
by andypugh
Is it too much trouble to use the conversion blocks when this is required?
Replied by andypugh on topic Explaining mux_generic
I have come across situations where I have wanted to output to both types of pins at the same time.
Is it too much trouble to use the conversion blocks when this is required?
Please Log in or Create an account to join the conversation.
15 Sep 2014 22:45 #51199
by cmorley
well comparing:
loading another component
making _another_ descriptives signal name
remembering to addf that component
to:
connect to an existing pin
just to connect two components together.
yes the conversion components are a bit of a pain and cludgy.
Is there a disadvantage to having both pins available?
Chris M
Replied by cmorley on topic Explaining mux_generic
I have come across situations where I have wanted to output to both types of pins at the same time.
Is it too much trouble to use the conversion blocks when this is required?
well comparing:
loading another component
making _another_ descriptives signal name
remembering to addf that component
to:
connect to an existing pin
just to connect two components together.
yes the conversion components are a bit of a pain and cludgy.
Is there a disadvantage to having both pins available?
Chris M
Please Log in or Create an account to join the conversation.
15 Sep 2014 22:52 #51200
by andypugh
The boolean, int and signed-int variants of mux_generic can run in the base thread, but the float versions can't.
Replied by andypugh on topic Explaining mux_generic
Is there a disadvantage to having both pins available?
The boolean, int and signed-int variants of mux_generic can run in the base thread, but the float versions can't.
Please Log in or Create an account to join the conversation.
16 Sep 2014 05:32 - 16 Sep 2014 05:33 #51210
by Duc
Replied by Duc on topic Explaining mux_generic
Working on the code some but running into some issues. The switch is a rotary switch that is either on or off so I did a bit input with a signed 32 bit output. 5 inputs from the rotary switch
Error code
Code Im trying
Error code
Pin 'mux-gen.00.sel-bit000' does not exist.
Code Im trying
loadrt mux_generic config="bs5"
addf mux-gen.00 servo-thread
# --- Feedrate overide - FO-INCR-A ---
net fo-incr-a <= hm2_5i25.0.7i84.0.1.input-08
# --- FO-INCR-B ---
net fo-incr-b <= hm2_5i25.0.7i84.0.1.input-07
# --- FO-INCR-C ---
net fo-incr-c <= hm2_5i25.0.7i84.0.1.input-06
# --- FO-INCR-D ---
net fo-incr-d <= hm2_5i25.0.7i84.0.1.input-05
# --- FO-INCR-E ---
net fo-incr-e <= hm2_5i25.0.7i84.0.1.input-04
# connect feed overide increments - switches
setp halui.feed-override.count-enable true
setp halui.feed-override.direct-value true
setp halui.feed-override.scale .01
net feedoverride-incr => halui.feed-override.counts
net fo-incr-a => mux-gen.00.sel-bit000
net fo-incr-b => mux-gen.00.sel-bit001
net fo-incr-c => mux-gen.00.sel-bit002
net fo-incr-d => mux-gen.00.sel-bit003
net fo-incr-e => mux-gen.00.sel-bit004
net feedoverride-incr <= mux-gen.00.out-s32
setp mux-gen.00.debounce-us 200000
setp mux-gen.00.suppress-no-input False
setp mux-gen.00.in-s32-00 0.000000
setp mux-gen.00.in-s32-01 10.000000
setp mux-gen.00.in-s32-02 20.000000
setp mux-gen.00.in-s32-03 30.000000
setp mux-gen.00.in-s32-04 40.000000
setp mux-gen.00.in-s32-05 50.000000
setp mux-gen.00.in-s32-06 60.000000
setp mux-gen.00.in-s32-07 70.000000
setp mux-gen.00.in-s32-08 80.000000
setp mux-gen.00.in-s32-09 90.000000
setp mux-gen.00.in-s32-10 100.000000
setp mux-gen.00.in-s32-11 110.000000
setp mux-gen.00.in-s32-12 120.000000
setp mux-gen.00.in-s32-13 130.000000
setp mux-gen.00.in-s32-14 140.000000
setp mux-gen.00.in-s32-15 150.000000
Last edit: 16 Sep 2014 05:33 by Duc.
Please Log in or Create an account to join the conversation.
16 Sep 2014 05:53 #51212
by andypugh
I often find it helpful to load a component at a halrun prompt, just to try out the options and see what the pins are called.
Replied by andypugh on topic Explaining mux_generic
Pin 'mux-gen.00.sel-bit000' does not exist.
I often find it helpful to load a component at a halrun prompt, just to try out the options and see what the pins are called.
andypugh@dn2800:~/git/linuxcnc-dev$ halrun
halcmd: loadrt mux_generic config=bs5
halcmd: show pin
Component Pins:
Owner Type Dir Value Name
4 u32 IN 0x00000000 mux-gen.00.debounce-us
4 bit IN FALSE mux-gen.00.in-bit-00
4 bit IN FALSE mux-gen.00.in-bit-01
4 bit IN FALSE mux-gen.00.in-bit-02
4 bit IN FALSE mux-gen.00.in-bit-03
4 bit IN FALSE mux-gen.00.in-bit-04
4 s32 OUT 0 mux-gen.00.out-s32
4 bit IN FALSE mux-gen.00.sel-bit-00
4 bit IN FALSE mux-gen.00.sel-bit-01
4 u32 IN 0x00000000 mux-gen.00.sel-int
4 bit IN FALSE mux-gen.00.suppress-no-input
Please Log in or Create an account to join the conversation.
Time to create page: 0.085 seconds