lut5 multiple functions on same inputs

More
8 years 4 weeks ago #118390 by smalla
Hi all,

I ran into a problem trying to simplify a user interface, which is a simple rotary switch and a button. Depending on the switch position and button pressing, it should do rather different things.

lut5 is a good choice to implement the logic, but uses quite a lot of code, as one lut5 name can only process one function.

it is possible to write a switch-case like code somehow?
or is it possible to modify lut5 to accept more than one function? Something like lut5.0.0x01.out will produce output for the 0x01 truth table, and lut5.0.0x567013a.out will be true if 0x567013a is true.
Function is defined on the output line. Or this is not possible as linuxcnc-s logic is preventing it.
But Im sure multiple functions could be defined with multiple outs.
Is there a better way?

Thanks

Please Log in or Create an account to join the conversation.

More
8 years 4 weeks ago - 8 years 4 weeks ago #118403 by Todd Zuercher
To be honest I'd probably just use a bunch of and2 components to do what you are trying to do. Use one and2 for each of the knob outputs, then connect all of the other inputs of the and2s to the output of the button.
Last edit: 8 years 4 weeks ago by Todd Zuercher.

Please Log in or Create an account to join the conversation.

More
8 years 4 weeks ago #118409 by smalla
OK the rotary switch is not that simple, it uses gray code to encode 16 positions. 4 wires + one for the button. Thats five inputs. With and2 it would be a way too complex.

Please Log in or Create an account to join the conversation.

More
8 years 4 weeks ago #118415 by Todd Zuercher
I don't know then, looks like your options are:
-use a bunch of lut5s
-use ladder logic (Classicladder)
-write a comp

Please Log in or Create an account to join the conversation.

More
8 years 4 weeks ago #118416 by Todd Zuercher
It seems as though there should be a way to do it with a couple of select8s and a couple of other components. But I don't have the time to think that all through.

Please Log in or Create an account to join the conversation.

More
8 years 4 weeks ago - 8 years 4 weeks ago #118417 by Todd Zuercher
I couldn't stop thinking about it, 2 select8s weighted_sum and 2 and2s should get it.
Connect 3 of the signals from your switch to the weighted_sum inputs (so you get an integer of 0-7 for all of your switch settings. Connect the output of the weighted_sum to both of the select8s s32 inputs. The 4th output from your switch use both the out and the out-not, connect one of those to first input of each and2. Connect your button output to the other input of each of the and2s. And finally connect the outputs of the and2s to the enables of the select8s (one to each).
Last edit: 8 years 4 weeks ago by Todd Zuercher.

Please Log in or Create an account to join the conversation.

Time to create page: 0.360 seconds
Powered by Kunena Forum