Disable Positive Limit or Change Limit Port

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Disable Positive Limit or Change Limit Port

Postby nhcnc » Fri Oct 21, 2022 7:33 pm

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.
nhcnc
 
Posts: 5
Joined: Fri Oct 21, 2022 7:17 pm

Re: Disable Positive Limit or Change Limit Port

Postby nhcnc » Sat Oct 22, 2022 4:51 pm

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 *******************************/

nhcnc
 
Posts: 5
Joined: Fri Oct 21, 2022 7:17 pm

Re: Disable Positive Limit or Change Limit Port

Postby fsli » Sat Oct 22, 2022 5:00 pm

Couldn't you just use a different input for the turret?
Frank
fsli
 
Posts: 97
Joined: Mon Jul 11, 2022 12:36 am

Re: Disable Positive Limit or Change Limit Port

Postby dezsoe » Sat Oct 22, 2022 8:05 pm

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.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Disable Positive Limit or Change Limit Port

Postby nhcnc » Sat Oct 22, 2022 9:27 pm

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.
nhcnc
 
Posts: 5
Joined: Fri Oct 21, 2022 7:17 pm

Re: Disable Positive Limit or Change Limit Port

Postby dezsoe » Sat Oct 22, 2022 10:16 pm

You can simply set an output trigger for LED 28 (Toolchangeinprogress) to control the relay.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary


Return to Macros

Who is online

Users browsing this forum: No registered users and 8 guests