Spindle-at-speed with direction

More
19 Mar 2020 06:20 #160713 by kimachren
Hi,

I'm trying to figure out how do do a spindle-at-speed check with direction awareness.
The problem is that when doing a M4 S2000 (-2000rpm) from a previous M3 S3000 (+3000rpm), the "near" function triggers the spindle-at-speed already at +2000rpm. I have tried to use a comp with encoder velocity against 0 (zero) to get the direction of the actual rotation and "and"-ing it with "spindle-reverse"-signal to check if it is rotating in correct direction. The problem with this is that and2 only gives TRUE when both inputs are TRUE and hence no luck when spindle-reverse is FALSE.

Any suggestions?

Please Log in or Create an account to join the conversation.

More
19 Mar 2020 07:21 #160716 by cmorley
how do you have it connected now - can you post your HAL files?

Please Log in or Create an account to join the conversation.

More
19 Mar 2020 07:56 - 19 Mar 2020 07:57 #160717 by alkabal
Hi

You can use the not component for reversing bit status

Or (better) use lut5 you can connect 5 signal and mix 0/1 status.

Br
Last edit: 19 Mar 2020 07:57 by alkabal.
The following user(s) said Thank You: kimachren

Please Log in or Create an account to join the conversation.

More
19 Mar 2020 08:07 #160718 by kimachren
I can't post HAL files now because I'm at work, and the machine is at home.

But this is the principle (same as everybody elses for sure):

net .... ... pid.s.command -> near.0.in0
net .... .. pid.s.feedback -> near.0.in1

net spindle-at-speed ... .. near.0.out

I tried something like this:

setp comp.0.in0 0 (zero)

net .... ... pid.s.command -> near.0.in0
net .... .. pid.s.feedback -> near.0.in1

net .... hm2..encoder...velocity -> comp.0.in1 (pins may have been the opposite)

net .... .... and2.0.in0 comp.0.out
net spindle-reverse .... and2.0.in1

net .... and2.1.in0 and2.0.out
net ...and2.1.in1 near.0.out

net spindle-at-speed and2.1.out


Does not work when spindle-reverse is FALSE even though the direction is correct, because and2 only gives TRUE when inputs are TRUE.

Please Log in or Create an account to join the conversation.

More
19 Mar 2020 08:53 #160720 by kimachren
thanks alkabal, lut5 looks like what I need.

Please Log in or Create an account to join the conversation.

More
19 Mar 2020 12:06 #160736 by bbsr_5a
you got also the direction signals from Hal that you can mix in your logic

Please Log in or Create an account to join the conversation.

More
20 Mar 2020 08:55 #160843 by kimachren
I'm unsure what signals you mean, but I got it working the way I described above. Just changing the two ands to lut5 with 100 and 111 as bit masks.
in0 is actual direction from encoder
in1 is wanted direction from program (reverse signal)
in2 is output from near.

Please Log in or Create an account to join the conversation.

More
23 Mar 2020 00:54 #161162 by andypugh
I think that the problem might be that you are looking at feedback and command that are possibly already absolute?

Try feeding the near component from the signed spindle.0.speed pin (or motion.spindle-speed-out) and comparing that to the signed version of the encoder velocity.

Please Log in or Create an account to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum