Homeing Soft limits

Moderators: TomKerekes, dynomotion

Post Reply
Remixter01
Posts: 4
Joined: Wed Jun 03, 2020 9:05 am

Homeing Soft limits

Post by Remixter01 » Wed Jun 03, 2020 9:19 am

Hi

I useing simplehomeindexfuctiontest for homeing and my question is how can I disable soft limits only for homeing button in Kmotioncnc?
I use 3 Limiting Switches on 3 axis for Homeing.
Hi ;)

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

Re: Homeing Soft limits

Post by TomKerekes » Wed Jun 03, 2020 1:37 pm

Set the soft limits to huge values. ie 1e30 and -1e30. Then after homing finishes set to normal values.
Regards,

Tom Kerekes
Dynomotion, Inc.

Remixter01
Posts: 4
Joined: Wed Jun 03, 2020 9:05 am

Re: Homeing Soft limits

Post by Remixter01 » Wed Jun 03, 2020 1:47 pm

Thank you! That will work i will add new soft limits in program before and after homing :D
Hi ;)

Remixter01
Posts: 4
Joined: Wed Jun 03, 2020 9:05 am

Re: Homeing Soft limits

Post by Remixter01 » Fri Jun 05, 2020 8:20 am

Hi

#Q1 I upgraded code but i have problem with randomly working limit switches.
Last day works good three times but at 4th just go back without touch limit switch.
Its randomly how its work.
I have 1 input for all 3 axes but can do more if that helps.
Limit Switches are reliably
Kind of Limit Switch:
Image
and its connect to KFLOP all to port 0

#Q2
I use DoPC(PC_COMM_HALT); on end because i think it will restart my coords after moved from Limit Switches,how can i restart coords in C?

my code:

Code: Select all

#include "KMotionDef.h"
#include "SimpleHomeIndexFunction.c" 
#define TMP 10
#include "KflopToKMotionCNCFunctions.c"

main()
{
	int result;
	
	
	ch0->LimitSwitchOptions=0x0;
    ch0->SoftLimitPos=1e30;
	ch0->SoftLimitNeg=-1e30;
	ch1->LimitSwitchOptions=0x0;
    ch1->SoftLimitPos=1e30;
	ch1->SoftLimitNeg=-1e30;
	ch2->LimitSwitchOptions=0x0;
    ch2->SoftLimitPos=1e30;
	ch2->SoftLimitNeg=-1e30;

	// HOME Z
	
	result = SimpleHomeIndexFunction(2,  // axis number to home
			   10000.0,  // speed to move toward home
			   +1,      // direction to move toward home (+1 or -1)
			   0, 	// limit bit number to watch for
			   1,		// limit polarity to wait for (1 or 0)
               100.0,	// speed to move while searching for index
			   -1,		// index bit number to watch for (use -1                                                                                        for none)
			   1, 		// index polarity to wait for (1 or 0)
			   15000);	// amount to move inside limits
			   
	if (result==0)
	{
		printf("Home Z succeded\n");
	}
	else
	{
		printf("Home Z failed\n");
		return;
	}
	
	// HOME X

	result = SimpleHomeIndexFunction(0,  // axis number to home
			   5000.0,  // speed to move toward home
			   +1,      // direction to move toward home (+1 or -1)       
			   0, 	// limit bit number to watch for
			   1,		// limit polarity to wait for (1 or 0) 
               100.0,	// speed to move while searching for index
			   -1,		// index bit number to watch for (use -1 for none)
			   1, 		// index polarity to wait for (1 or 0)
			   45000);	// amount to move inside limits
			   
	if (result==0)
	{
		printf("Home X succeded\n");
	}
	else
	{
		printf("Home X failed\n");
		return;
	}
	
	// HOME Y

	result = SimpleHomeIndexFunction(1,  // axis number to home
			   10000.0,  // speed to move toward home
			   -1,      // direction to move toward home (+1 or -1)
			   0, 	// limit bit number to watch for
			   1,		// limit polarity to wait for (1 or 0)
               100.0,	// speed to move while searching for index
			   -1,		// index bit number to watch for  (use -1 for none)
			   1, 		// index polarity to wait for (1 or 0)
			   43000);	// amount to move inside limits
		   
				ch0->LimitSwitchOptions=0x0;
				ch0->SoftLimitPos=46000;
				ch0->SoftLimitNeg=-46000;
				ch1->LimitSwitchOptions=0x0;
				ch1->SoftLimitPos=60000; 
				ch1->SoftLimitNeg=-4e+4; 
				ch2->LimitSwitchOptions=0x0;
				ch2->SoftLimitPos=18000;
				ch2->SoftLimitNeg=-30000;  
				DoPC(PC_COMM_HALT); // stop KMotionCNC	
	if (result==0)
	{
		printf("Home Y succeded\n");
	}
	else
	{
		printf("Home Y failed\n");
		return;
	}
					
}
	


Hi ;)

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

Re: Homeing Soft limits

Post by TomKerekes » Sat Jun 06, 2020 4:44 pm

Hi Remixter01,

KFLOP Input Bit 0 must be driven low (< 0.4V) and driven high (> 2.4V) to work reliably. A simple switch can not do this. How do you have it wired?
Regards,

Tom Kerekes
Dynomotion, Inc.

Remixter01
Posts: 4
Joined: Wed Jun 03, 2020 9:05 am

Re: Homeing Soft limits

Post by Remixter01 » Mon Jun 08, 2020 7:27 am

limit switches are connected indirectly through the optical module I/O.
If limit switch its activated then gives 4V if not 0V
Axis go back even if limit switch wasn't give a signal
Hi ;)

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

Re: Homeing Soft limits

Post by TomKerekes » Mon Jun 08, 2020 4:18 pm

Hi Remixter01,
Last day works good three times but at 4th just go back without touch limit switch.
Does this mean the axis was moving toward the limit switch but then reversed as if it hit the switch but had not reached the limit switch yet? In this case the most likely thing would be noise causing a false limit condition.


limit switches are connected indirectly through the optical module I/O.
What kind of optical module? How long is the wiring between it and KFLOP?

You might try adding a filter capacitor (~0.1uF Ceramic) close to KFLOP to filter noise spikes.


If limit switch its activated then gives 4V if not 0V
Is it driven to 0V? Or just left "floating"?
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply