On 05/17/2018 08:24 AM, andy pugh wrote:
It isn't clear from your description precisely when you want this to happen, but I imagine that choosing the conditions is also something easiest inside the custom component.
Let me explain what mr. Lemonnier is trying to do.
He has a signal from an external device. He wants to record the position of an encoder when there is a pulse from that device. Now, the rub is he wants to be moving the axes quickly, so that there are multiple encoder counts/servo period. but, he wants the exact position recorded when the pulse comes.

So, after stewing over his problem for a while, I realized there was a way to do it. Feed the encoder to TWO encoder counters. One works normally, and is for position control under LinuxCNC. The other receives the external pulse on the Z input. And, when the external pulse is expected, turn on the index-enable pin of encoder. When the pulse comes, the encoder counter will be zeroed, just like a spindle encoder on a G33.1 or an axis when homing to the index pulse. Now, motion continues, and then the servo thread triggers. The axis will have the position when the servo period triggered, and the extra encoder counter will have the distance traveled between the pulse on Z and when the servo period triggered. By calculating axis position MINUS extra encoder, you get the axis position when the Z pulse triggered the extra encoder to zero.

So, a component needs to set the encoder-index to true, and then watch for it to go false. When it sees the encoder-index go false, if does the subtraction and stores the difference in a net. It then turns the index-enable back to true.


Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Emc-users mailing list

Reply via email to