prohibit tool release when M03 is active

Post Reply
Olympus
Posts: 5
Joined: Fri Aug 17, 2018 3:12 pm

prohibit tool release when M03 is active

Post by Olympus » Thu Sep 13, 2018 3:36 pm

I want to put in a manual tool release with a toolchanger and want to prohibit a tool release if M03 is active what is the procedure to enable this

mycnc
Posts: 160
Joined: Thu May 10, 2018 2:42 pm

Re: prohibit tool release when M03 is active

Post by mycnc » Fri Sep 14, 2018 5:15 am

There are many ways to do it.

A standard M03 (Spindle ON) procedure is shown below

Code: Select all

#include pins.h
#include vars.h

main()
{
  timer=0;
  proc=plc_proc_spindle;

  val=eparam;
  dac01=val;

  portclr(OUTPUT_CCW_SPINDLE);
  portset(OUTPUT_SPINDLE);

  gvarset(7370,1);//Spindle State
  gvarset(7371,eparam);//Spindle Speed Mirror register

  command=PLC_MESSAGE_SPINDLE_SPEED_CHANGED;
  parameter=eparam;
  message=PLCCMD_REPLY_TO_MYCNC;
  timer=10;do{timer--;}while (timer>0);  //pause to push the message with Spindle Speed data


  timer=spindle_on_delay; do{timer--;}while (timer>0); //delay for Spindle reach given speed

  exit(99);	//normal exit 
};

It's easy to see 3 solutions from the source.

Solution #1 - check internal variable "proc" in tool change procedure and quit if it's equal "pcl_proc_spindle"

Code: Select all

.......
if (proc==plc_proc_spindle)
{
exit(100);  //exit with error. A complete g-code will be stopped if get this exit code.
};
......

Solution #2 - check global variable 7370 (which is used as "Spindle State") . if the register value if not zero, then exit from toolchange

Code: Select all

.......
if (gvarget(7370)!=0)
{
exit(100);  //exit with error. A complete g-code will be stopped if get this exit code.
};
......

Solution #3 - check Spindle relay output pin and exit from tool change procedure if it's not zero.
Global register #7184 (GVAR_HW_OUTPUTS0) contains a binary field for output pins 0...31.
Need to check bit corresponding to Spindle relay

Code: Select all

.......
a=gvarget(7184)&(1<<OUTPUT_SPINDLE);

if (a!=0)
{
exit(100);  //exit with error. A complete g-code will be stopped if get this exit code.
};
......

Post Reply