Checking for axis limit hit during Jog or Move

Moderators: TomKerekes, dynomotion

Post Reply
LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

Checking for axis limit hit during Jog or Move

Post by LarryJD » Tue Sep 07, 2021 12:39 am

Hi,

I'm sure there is a simple answer to this, but I haven't been able to find a discussion that relates to this question. The question is in regard to my Kflop C programs that Jog to a external signal such as a probe detection. For a probe Jog, my while loop implements a timeout along with the ReadBit for the probe input. For a probe Move, there is also a check for an unexpected probe trigger as well as a timeout. These goes a long way in protecting the probe from a bone-headed operator (that being me).

The reason for the timeout in the Jog while loop is to handle the probe missing its target. In the Move, the timeout is mainly used to exit the while loop if a limit is hit .

I'd like to be able to directly check for hitting an axis limit switch or soft limit. Is there a way to pole for the axis being stopped due to hitting a limit or anything else that can stop the motion during a Jog or a Move?

I'm using version 4.3.5f
Thanks,
Larry

User avatar
TomKerekes
Posts: 2529
Joined: Mon Dec 04, 2017 1:49 am

Re: Checking for axis limit hit during Jog or Move

Post by TomKerekes » Tue Sep 07, 2021 2:07 am

Hi Larry,

Depending on Limit Switch Options a limit switch may trigger a Feed Hold or it may Disable the Axis. Soft limits will trigger a Feed Hold. You might just check for either conditions.

For Feed Hold you can check this for non-zero

Code: Select all

extern int CS0_StoppingState; 			// emergency stop in progress, 0 = not stopping, 1=stopping coord motion, 2=stopping indep, 3=fully stopped, 4=ind stopped

For an Axis disabled you can check axis Enable status: ie

Code: Select all

if (!ch0->Enabled) ....
There shouldn't be any other normal cases where motions stops except for something extreme like power turned off, amplifiers disabled, EStop, Axis Configuration changed, etc.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

LarryJD
Posts: 15
Joined: Wed Sep 01, 2021 6:15 pm

Re: Checking for axis limit hit during Jog or Move

Post by LarryJD » Tue Sep 07, 2021 5:36 pm

Excellent, I will check for both. Thank you very much Tom and thank you too for replying so quickly!

Larry
Thanks,
Larry

Post Reply