Page 1 of 1
Disable Positive Limit or Change Limit Port

Posted:
Fri Oct 21, 2022 7:33 pm
by nhcnc
Hello,
I'm retrofitting a CNC where all the +Limits X/Y/Z/Tool Turret and Home switches are shared to a single pin. The problem I'm having is the tool turret hits the home switch/shared+ limit when indexing to past tool 1 causing UCCNC to stop and go into reset and abort the change.
What I want to do is disable the + limits temporarily while the Turret is changing tools. Is there a code to disable the limits or an example of how to redefine the ports and pins for the +limits in a macro?
I tried toggling the Ignore Limits in the macro but it still stops when it hits the limit/home switch.
Re: Disable Positive Limit or Change Limit Port

Posted:
Sat Oct 22, 2022 4:51 pm
by nhcnc
Does this seem to be a legit solution or is there a better way?
- Code: Select all
/**********************************************Limit Fix Begin*************************/
//Save the ports and pins for the positive limits
string XPosPort = AS3.Getfield(244);
string XPosPin = AS3.Getfield(4);
string ZPosPort = AS3.Getfield(254);
string ZPosPin = AS3.Getfield(34);
//Set all the ports and pins to zero to disable + limits
AS3.Setfield(0,244);
AS3.Setfield(0,4);
AS3.Setfield(0,254);
AS3.Setfield(0,34);
//Apply Changes
exec.Callbutton(168);
MessageBox.Show("Ports and Pins Set");
/**********************************************Limit Fix End*************************/
/********************************Reset Pins Begin *******************************/
//Set all the ports and pins back to enable + limits
AS3.Setfield(Convert.ToDouble(XPosPort),244);
AS3.Setfield(Convert.ToDouble(XPosPin),4);
AS3.Setfield(Convert.ToDouble(ZPosPort),254);
AS3.Setfield(Convert.ToDouble(ZPosPin),34);
//Apply Changes
exec.Callbutton(168);
MessageBox.Show("Ports and Pins Reset");
/********************************Reset Pins End *******************************/
Re: Disable Positive Limit or Change Limit Port

Posted:
Sat Oct 22, 2022 5:00 pm
by fsli
Couldn't you just use a different input for the turret?
Re: Disable Positive Limit or Change Limit Port

Posted:
Sat Oct 22, 2022 8:05 pm
by dezsoe
After Setfield you should call Validatefield too. But it will not work, because you normally want to change tool while a g-code is running, but you should never call Apply or Save while cycle is started. You need to use a different input for that home switch or if you don't have any more then you may use an output to drive a relay to temporary bypass that home switch.
Re: Disable Positive Limit or Change Limit Port

Posted:
Sat Oct 22, 2022 9:27 pm
by nhcnc
I’d rather not modify anything on the machine side, the current implementation is plug and play with the oem controller. The relay idea might work if there is no other solution.
Re: Disable Positive Limit or Change Limit Port

Posted:
Sat Oct 22, 2022 10:16 pm
by dezsoe
You can simply set an output trigger for LED 28 (Toolchangeinprogress) to control the relay.