Hello Guest it is May 12, 2021, 05:57:43 PM

Author Topic: Resetting Encoder Count Via a BRAIN  (Read 6968 times)

0 Members and 1 Guest are viewing this topic.

Re: Resetting Encoder Count Via a BRAIN
« Reply #10 on: May 27, 2009, 11:50:54 PM »
If I understand correctly, Encoder 1 is the encoder that correspnds to the X-axis encoder and OEM button code 133 can be used to zero that encoder count.  I'll give that a shot. Thanks for the help.


Re: Resetting Encoder Count Via a BRAIN
« Reply #11 on: May 28, 2009, 09:26:12 AM »
YEP you can use two of the encoders to do a compare function  and it does not matter which 2 (;-)

IF encoder(1) = Encoder(2) (+/-) then ok
If encoder(1) <> Encoder(2) (+/-) then STOP and (most important)


ON ESTOP and  rehome axis  then  Function 133 & 134 ( reset encoder dro to zero to resync test function)

AND double check your Encoder(0)   YES ART normally started his naming sequence with (0) being the X axis   x=0 y=1 z=2 ,etc

YEP that should about do it(;-), TP
« Last Edit: May 28, 2009, 09:29:33 AM by vmax549 »
Re: Resetting Encoder Count Via a BRAIN
« Reply #12 on: May 28, 2009, 11:28:05 AM »
I apologize for not communicating clearly. My ultimate goal is to detect racking of the gantry and stop the machine before damage can be done. The gantry is moved by a lead screw on each side. My plan is to have a rotary encoder at the end of each screw. When I detect that one screw is not keeping up with the other, then issue a stop command. My problem is establishing the inital conditions for each encoder. I am sure there are many ways to solve this problem. My first thought was to detect when the machine is in an e-stop state and then zero each encoder count via a brain. When the machine is taken out of the e-stop state, then have the brain compare the two counts and stop he machine if they differ by more than a few counts.

If there is no way to zero the counts, then my next thought was to read the counts into a variable when the machin is in an e-stop condition. Call these the initial count variables (a variable for each encoder). Once the machine is out of the e-stop condition, subtract the initial count variables from the encoder readings. Again, if these readings differ by more than a few counts, stop the machine.

I am open to a completely different approach. Perhaps I need to assign the encoder to an MPG or axis DRO. Perhaps my newness to Mach is making this a much more difficult problem than it should be.

You could zero the encoders using an initialization macro, and use that same macro to re-zero after a fault, as it simply executes as an M-code.  You could also use the macropump to do the detection, rather than a brain, if you wanted to.  I think the only downside would be the slower update rate - about 10 times per second, IIRC,

Ray L.
Ray L.