one button multiple functions
For example, for connecting a button that will run the thing, I tried:
net halui-run hm2_7i43.0.gpio.016.in_not => halui.mode.auto halui.program.run
Same for other buttons. Need a "HALUI=halui" in your .ini file first.
It kind of works, but I think that I need a custom component to support all the necessary logic so that it works just as AXIS does. Or, better, I'll try to make something that does RUN/PAUSE/STOP on the same button. I was thinking something like doing a STOP action when pressed for more that one sec, or something.
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
hi john i have looked at the examples and have looked at the docs i cant figure out how to write the hal so that one button will do more the 2 functions as i want to use one momentary buttom on my pendant to cycle through my jog steps. i cant find an example any wheere with more then two functions. thanx for your help
I think you probably need to use updown and select8
www.linuxcnc.org/docview/html/man/man9/updown.9.html
www.linuxcnc.org/docview/html/man/man9/select8.9.html
Your button would increment the counter (with wrap) and then the individual bits from select8 would perform the various functions.
Please Log in or Create an account to join the conversation.
This is an example of a custom multi position switch component that combines the functionality of the components that Andy highlighted in one.
It has a pin toggle, which increments the count and sends the next pin true until it reaches its limit and it cycles back to off.
It is written very simply, so that it is easy to alter, you could use bitwise operators etc and considerably reduce the code size but at the expense of readablity.
If it is of use, borrow with pride
regards
NB Now at www.linuxcnc.org/index.php/english/compo...id=47&id=15803#15803
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
This will tell you about building and installing a component using comp
linuxcnc.org/docs/html/hal_comp.html
I'll come back to you with with something re connections later, dashing out now.
Read the header of the .comp file for generic example connections to a parport and how to load the component in your hal file
regards
Please Log in or Create an account to join the conversation.
Having read the previous link you will have noted that to compile the component you just need
sudo comp --install multiswitch.comp from a directory with the multiswitch.comp file in it
That will compile multiswitch.ko and copy it to /usr/realtime-2.6.32-122-rtai/modules/emc2 on a vanilla install of Ubuntu 10.4 from Live CD.
To use the component, lets take Big Johns' Simple Remote Pendant as an example.
wiki.linuxcnc.org/emcinfo.pl?Simple_Remote_Pendant
First load the multiswitch component, set it to 3 positions (because we are using state0 as an unconnected off position).
Then set a button output linked to the multiswitch.0.toggle input, in this case input.0.btn-thumb.
Then just need to substitute the button outputs that were linked to the or2 components
for multiswitch.0.stateN output pins.
The result will allow cycling through the off/slow/med/fast jog speeds, just using the one button.
The below .hal file code shows this.
Compare it to the original code in the wiki and you should see the changes easily.
loadrt or2 count=2
loadrt mux4 count=1
loadrt multiswitch
addf multiswitch.0 servo-thread
setp multiswitch.0.positions = 3
addf or2.0 servo-thread
addf or2.1 servo-thread
addf mux4.0 servo-thread
# set the jog speed for the joypad again use numbers that make sense for your machine
setp mux4.0.in0 0 # this one must be 0 to prevent motion unless a button is pressed
setp mux4.0.in1 25
setp mux4.0.in2 100
setp mux4.0.in3 200
## defaults to off, press once for speed-slow, 2nd press gets medium,
## next press for fast, press again and back to off
net toggle-signal multiswitch.0.toggle <= input.0.btn-thumb
net remote-speed-slow or2.0.in0 <= multiswitch.0.state1
net remote-speed-medium or2.1.in0 <= multiswitch.0.state2
net remote-speed-fast or2.0.in1 or2.1.in1 <= multiswitch.0.state3
net joy-speed-1 mux4.0.sel0 <= or2.0.out
net joy-speed-2 mux4.0.sel1 <= or2.1.out
net joy-speed-final halui.jog-speed <= mux4.0.out
Health warning:
This is just a back of an envelope example of the principle, not a cut and paste .hal file, you will have to tailor to your needs and
test it.
The component may need a delay built in to prevent cycling through the states, if the button is not just pressed momentarily.
If that is the case let me know and I will devise something.
regards
Please Log in or Create an account to join the conversation.