simple rotary encoder for feed override?
10 Feb 2018 17:59 - 10 Feb 2018 18:00 #105715
by IrishMoss
simple rotary encoder for feed override? was created by IrishMoss
Hi,
I'm trying to setup a rotary encoder to control feed override. not a mpg, just a cheap encoder like this:
I've been going through the HAL docs and looking at examples, and I still can't figure it out. So far this HAL stuff just hasn't 'clicked' with me yet. Seems the more examples i find, the more confused I get.
I've got the a-out and b-out pins hooked up to pins 13 and 15 on my breakout board, and ground to ground (i'm not using the push-click switch).
So far, this is what I have in my custom.hal:
What it does with this is each turn/click either increases or decreases the feed override setting, and then immediately bounces back to it's original value.
I feel like it's one simple thing I'm missing somewhere in my hal, but can't figure it out.
...feeling rather hal-incompetent at the moment.
I'm trying to setup a rotary encoder to control feed override. not a mpg, just a cheap encoder like this:
I've been going through the HAL docs and looking at examples, and I still can't figure it out. So far this HAL stuff just hasn't 'clicked' with me yet. Seems the more examples i find, the more confused I get.
I've got the a-out and b-out pins hooked up to pins 13 and 15 on my breakout board, and ground to ground (i'm not using the push-click switch).
So far, this is what I have in my custom.hal:
# rotary encoder for feed override control
loadrt encoder num_chan=1
addf encoder.capture-position servo-thread
addf encoder.update-counters base-thread
setp halui.feed-override.count-enable true
setp halui.feed-override.direct-value false
net feedup => halui.feed-override.increase
net feeddown => halui.feed-override.decrease
net feedup encoder.0.phase-A <= parport.0.pin-15-in
net feeddown encoder.0.phase-B <= parport.0.pin-13-in
What it does with this is each turn/click either increases or decreases the feed override setting, and then immediately bounces back to it's original value.
I feel like it's one simple thing I'm missing somewhere in my hal, but can't figure it out.
...feeling rather hal-incompetent at the moment.
Last edit: 10 Feb 2018 18:00 by IrishMoss. Reason: typo
Please Log in or Create an account to join the conversation.
11 Feb 2018 00:20 #105727
by cmorley
Replied by cmorley on topic simple rotary encoder for feed override?
you don't want to connect to halui.feed-override.increase or decrease.
you want to connect encoder.0. counts to halui.feed-override.counts
you might have to scale the counts too.
parport pins control the encoder commponent - it counts the changes.
The encoder component sends the count number to the halui.feed-overide component.
the halui.feed-override component sends messages to linuxcnc based on the counts.
linuxcnc.org/docs/2.7/html/gui/halui.html
linuxcnc.org/docs/2.7/html/hal/rtcomps.html#_encoder
Hope that helps.
Chris M
you want to connect encoder.0. counts to halui.feed-override.counts
you might have to scale the counts too.
parport pins control the encoder commponent - it counts the changes.
The encoder component sends the count number to the halui.feed-overide component.
the halui.feed-override component sends messages to linuxcnc based on the counts.
linuxcnc.org/docs/2.7/html/gui/halui.html
linuxcnc.org/docs/2.7/html/hal/rtcomps.html#_encoder
Hope that helps.
Chris M
The following user(s) said Thank You: IrishMoss
Please Log in or Create an account to join the conversation.
11 Feb 2018 02:35 #105731
by IrishMoss
Replied by IrishMoss on topic simple rotary encoder for feed override?
Thank you!!!
I knew I was missing something simple, just not sure I ever would have made that connection on my own.
Here's the code now, in case this helps any other hal-impaired folks like myself
I knew I was missing something simple, just not sure I ever would have made that connection on my own.
Here's the code now, in case this helps any other hal-impaired folks like myself
# rotary encoder for feed override control
loadrt encoder num_chan=1
addf encoder.capture-position servo-thread
addf encoder.update-counters base-thread
setp halui.feed-override.scale .005
net feedcount halui.feed-override.counts <= encoder.0.counts
net feedup encoder.0.phase-A <= parport.0.pin-15-in
net feeddown encoder.0.phase-B <= parport.0.pin-13-in
The following user(s) said Thank You: Tchefter
Please Log in or Create an account to join the conversation.
Time to create page: 0.094 seconds