23 position switch for feedrate override

More
14 Jun 2016 06:17 - 14 Jun 2016 06:31 #75959 by terkaa
Hi,

I have 23 position switch for controlling feedrate. Switch has 23 outs one for each value. I do not want to decode this into Gray,BCD or any other form to save IO because I have plenty. How do I connect these 23 inputs to HALUI? I have searched but I seem to find only examples that have coded switches. Pls no suggestions to change to different type switch etc. But suggestion how to make this switch work.

File Attachment:


Tero
Last edit: 14 Jun 2016 06:31 by terkaa.

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

More
14 Jun 2016 10:47 #75979 by BigJohnT
Take look at the weighted sum component.
linuxcnc.org/docs/2.7/html/man/man9/weighted_sum.9.html
and my example sim.
gnipsel.com/linuxcnc/configs/w-sum.zip

JT
mesaus.com
The following user(s) said Thank You: terkaa

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

More
14 Jun 2016 11:18 #75987 by andypugh
I think that JT's suggestion of weighted-sum is the most likely to work, but you will need two of them added together to get enough input bits as it is limited to 16 inputs.
The following user(s) said Thank You: terkaa

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

More
14 Jun 2016 13:31 #76005 by terkaa
Hi,

After setting weights & inputs it works. I used it also for spindle override. Thanks for pointing me to right direction.

Tero

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

More
14 Jun 2016 13:35 #76007 by cmorley
Are you using the rest of the buttons on the Okuma panel.
I'm just curious how you decoded them.
I've been playing with a Okuma lathe panel.

Chris M

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

More
14 Jun 2016 13:58 - 14 Jun 2016 14:02 #76011 by terkaa
I am going to use some buttons ie Machine lock, ATC Spindle control and jog buttons. Also leds of related buttons. Maybe tomorrow I have some time to do this.. There are 3 reasons for using Okuma panel 1: We are an all Okuma house except this one Cincinnati mill, so buttons will be in places users are used to. 2. We have these panels from dismantled from old machines. 3. These panels are very good and rugged. I will post some pics and info tomorrow. All pins to panel are described in Okuma electrical diagrams. Leds need to be flipped because okuma uses +5V common. (This is for 7i84 and 7i70 mesa cards)

Tero .
Last edit: 14 Jun 2016 14:02 by terkaa.

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

More
15 Jun 2016 05:36 #76041 by terkaa
Hi,

I used SUM2 component for adding these two wsums together. That required conv_s32_float and conv_float_s32 functions. Is there more elegant way to make this happen? (Component that would add two s32 values and output s32 value)

Tero

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

More
15 Jun 2016 09:33 #76047 by andypugh
Converting to float and back might actually result in unfortunate behaviour.
And I rather suspect that your feed increments need to be in floating-point anyway?

You could consider a very simple custom component:
linuxcnc.org/docs/2.7/html/hal/comp.html
I am writing the extemporaneously on a Windows machine, so can't test it.
component switch23 "Choose one of 23 input values";
pin in bit select-## [23] "The input bits";
pin in float value-## [23] "The output values";
pin out float out "Output";

license "GPL"

function _;

;;
int n;
for (n = 0; n < 23; n++)  if (select(n))  out = value(n)

Save that as switch23.comp then "sudo halcompile --install switch23.comp" to install it on your system, then "loadrt switch23" in your HAL file to use it, just like any other component.

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

More
15 Jun 2016 10:29 #76049 by terkaa
OK, I ended up writing custom sum2_signed component that takes signed values in and outputs signed value.


Tero

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

More
15 Jun 2016 11:02 #76052 by andypugh
As the feed-rate overide is a float, it might be neater to use the custom comp above.

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

Time to create page: 0.084 seconds
Powered by Kunena Forum