- Posts: 56
- Thank you received: 0
Overrides Hal example
Please Log in to join the conversation.
Gives you (one) the general idea of how to do this with HALUI.
Please Log in to join the conversation.
Mtndrew77 wrote: spindle override is a potentiometer with wiper connected to input 0 on my 7i76e, and the feedrate override is a 23 position selector switch with 5 outputs
So, there is an analogue voltage for spindle override and a 5-bit encoded feed override.
Your HAL / INI config will need to put the 7i76 into analogue input mode for the spindle.
In the HAL file. :
loadrt hm2_eth board_ip="192.168.1.121" config="firmware=hm2/7i76/7i76e.BIT num_encoders=1 num_pwmgens=0 num_stepgens=2 sserial_port_0=10xxxx"
You will then get some new pins, analogue inputs on IO pins 0 to 3.
Then
The example given by Chris seems to be using a mux-16 called "fo-incr", but you seem to have more that 16 options so need to use mux_generic
linuxcnc.org/docs/2.7/html/man/man9/mux_generic.9.html
For the feed-override I would start like this because it isn't clear how the switch is encoded.
The reason to set the inputs with numbers to match the input index is that you can then set up a halmeter on the mux-gen.00.out-float pin and see which input needs to be set to correspond to each switch position.
The switch is likely to be gray-code encoded, so the indexes will seem to jump about.
The rest of the config will be as Chris said.
Please Log in to join the conversation.
maybe not. I'm still struggling to wrap my head around the Mux Component. Does this sort of work like a switch statement in C? with the 24 in config="ff24" representing the number of different possible cases that determine the output of mux-gen.00.out?
Sorry if I'm being confusing, but like I said I'm still trying to wrap my head around it
Thanks
Please Log in to join the conversation.
Mtndrew77 wrote: I'm still struggling to wrap my head around the Mux Component. Does this sort of work like a switch statement in C? with the 24 in config="ff24" representing the number of different possible cases that determine the output of mux-gen.00.out?
It's a multiplexer, many inputs to one output. The "select" inputs choose which input is passed to the output.
mux2 is the simplest, two inputs and one output, the "select" bit switches between them.
mux4 has 2 select bits. We got up to mux16 before I decided that we just needed a general-purpose one that could also handle other data types.
The inputs can be set to constant values, or they can be linked to the output pins of other components.
I think my example might have a flaw, you probably need to use "ff32" so that it creates the right number of select bits. I think ff24 will only give you the integer indexer.
Please Log in to join the conversation.
is sort of like a switch statement then. The light bulb just went on over my head--Thanks for the help!
Please Log in to join the conversation.
Interestingly, that isn't how the less general-purpose mux components do it, they look like this:
github.com/LinuxCNC/linuxcnc/blob/master...components/mux4.comp
mux_generic is a lot more complicated
github.com/LinuxCNC/linuxcnc/blob/master...onents/mux_generic.c
Though the vast majority of that code only runs at setup time.
Please Log in to join the conversation.
Debug file information:
Note: Using POSIX realtime
./spindletest.hal:296: Pin 'mux-gen.00.sel-bit-000' does not
Please Log in to join the conversation.
Mtndrew77 wrote: Pin 'mux-gen.00.sel-bit-000' does not
Sorry, my mistake, the sel-bit-00 etc pins only have 2 digits.
I was going by the manpage, not a trial run.
(that still makes it my fault, I wrote the manpage
Please Log in to join the conversation.
Debug file information:
Note: Using POSIX realtime
./spindletest.hal:302: parameter or pin 'mux-gen.00.in-s32-00' not found
5789
Please Log in to join the conversation.
