Encoder Pins linked to LCNC

14 Jan 2019 18:08 #124176 by CORBETT
Hello Everyone,

I have read TOO much and finally asking for help. I do not like wasting people's time, but I need help hooking encoders up to LCNC. I am having problems with linking the correct pins from the ethercat module to LinuxCNC.

File Attachment:

File Name: kmb1.hal
File Size:8 KB

File Attachment:

File Name: hurcokmb1.ini
File Size:2 KB

File Attachment:

File Name: HAL-kmb1.txt
File Size:9 KB

File Attachment:

File Name: INI-hurcokmb1.txt
File Size:3 KB

File Attachment:

File Size:2 KB

I Have attached INI and HAL files (original and text version) if someone can point me in the correct direction I would appreciate the help. I have also attached a text file with the Encoder Pins listed as shown in HAL CONFIGURATION. Plus text files of the HAL and INI.

I have most all of the I/O functions working, but stuck on hooking the encoder pins up and working. I know there are other issues with my HAL code, but getting each thing working along and along is my objective. Plus feel free to correct me on anything I have wrong.

Have standard 200pr Omron Incremental Encoder attached to a Beckhoff EL5151 module. Have the hardware for all 3 axis, but simply concetrating on 1 axis to get working.

While in HAL CONFIGURATION, can see the module is enabled while pins is "shown". When in HAL OSCILLOSCOPE, cannot see any change when rotating the encoder shaft. Just trying to get the encoders working before bolting to the servo motors.

I do not have the beckhoff EL5151 PIN's correctly attached to LCNC, and is one of the main problems.

So that everyone can understand what I am doing or hooking up, I have a older Servomate Amp with 3 Electro-Craft DC Brush Servos, using the Analog +/-10V input. Removing the old 5V encoders, and installing the newer 24V encoders to work with my setup. The amps and servos are working fine, and already tuned. The computer went out and I am simply re-trofitting the computer and re-using the existing amps/servos. I have a full Beckhoff Ethercat setup with EL4132 for the Analog out to the Amps, will deal with those pins after getting the encoder working.

I know this will be easy for Andy (andypugh), Jon Elson, Pete Wallace, Chris Radek, Chris Morley, or John Thornton...
Plus many others that I have not named. Thanks to all of you for all the hard work that you do.

14 Jan 2019 18:41 #124177 by Todd Zuercher
I think where you are going wrong is that you are trying to use a software encoder counter. You need to let your Beckoff hardware do the encoder counting. All you should need to connect in hal should be your encoder scale and position feedback from the Ethercat. For some comparison look at some example hal files for other hardware encoder counter configs.
14 Jan 2019 23:54 #124200 by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC

First, let me apologize for not mentioning you in my previous post. I know you are on here all the time dealing with people like me, and I am glad for the help. I am definitely ready to get the machine running again.

Ok, I see what you are saying about hardware counting. I was under the impression the Beckhoff module was similar to a Pico or Mesa card and was simply a gateway for the encoder to attach to the computer.... and the computer doing the software counting. But this makes sense of why I am having such a problem, as I have focused totally on software counting.

I went back and pulled the beckhoff manual for the EL5151 and it states the following:

Incremental Encoder Interface EL5151

The EL5151 EtherCAT Terminal is an interface with 24 V inputs for the direct connection of incremental encoders. A 32 bit counter with a quadrature decoder and a 32 bit latch for the zero pulse can be read, set or enabled. The measurement of period and frequency is possible. The gate input allows the locking of the counter, selectively with a high or low level. The latch input is similarly configurable and evaluates high or low levels. From FW 02 the EL5151 supports distributed clocks, i.e. the input data can be synchronously acquired with other data that are similarly connected, distributed to distributed clock terminals. The universal system accuracy is around < 100 ns. With a moving axis, the micro-increment functionality offers 256 times higher axis position resolution than physically provided by the encoder. The EL5151 can also be used as a single-channel 32/16 bit counter on channel A, in which case the signal level on channel B defines the count direction.

After going back and reading the above, I see that it has a 32 bit counter and quadrature decoder. I read this nearly a year ago, but it did not click at all. I am not a programmer, nor a servo specialist. I have gotten to where I am at by reading, then reading some more, and then even more.... I will have to read and get this figured out now that you have pointed out what to do.

I am going to approach this just like you stated: "You need to let your Beckoff hardware do the encoder counting. All you should need to connect in hal should be your encoder scale and position feedback from the Ethercat."

I will work on this tonight and get back with you. Once again, thanks for getting back with me so quick.

15 Jan 2019 13:22 #124232 by Todd Zuercher
And that is exactly how Mesa and Pico hardware works as well. The encoders are counted in the hardware, and the hardware simply passes the position info back to Linuxcnc, just like your Beckoff hardware. The A and B states are passed through primarily for diagnostic purposes, or if the inputs need to be used as digital inputs instead of encoder counters. Those signals usually can not be relied upon for encoder counting because counts will be missed because of communication timing constraints (their state isn't polled fast enough to count encoder pulses.)
The following user(s) said Thank You: CORBETT
17 Jan 2019 04:18 #124320 by CORBETT
Replied by CORBETT on topic Encoder Pins linked to LCNC
I have to head out of town for work, but will get back with you when I can get some time to work on things. I ran out of time last night, just not enough time as usual. Anyway, thanks for getting back with me and I will message you when I get back from work and let you know where I am at with things.

Thanks again,
Time to create page: 0.115 seconds
Powered by Kunena Forum