Manual tool change M660 ?

Post Reply
oursomatic
Posts: 18
Joined: Mon Mar 09, 2020 2:19 pm

Manual tool change M660 ?

Post by oursomatic »

I am implementing manual tool change macro for my atc spindle prior to auto tool change rack

i use m6 macro builder as a base to start and i would like to understand what is m660 ?


N180 G90 G53 G0 X[#6181] Y[#6182] F#100
(manual load 7-20)
M660
G10 L81 P5400 Q5409(set current tool number)


I am planing to use M1 code to pause the M6 manual tool change until i physically did it then press START to let mycnc write the new tool and add the G43 offset

Do you have a better way to handle it ?

oursomatic
Posts: 18
Joined: Mon Mar 09, 2020 2:19 pm

Re: Manual tool change M660 ?

Post by oursomatic »

M1 is OK to paused the M6 procedure for manualy changing the tool in spindle.
It is only missing a popup message to tell Tn .

i have try tu use a popup message but i did not find how to implement it into a macro instead of PLC
i have try with G10L180 P9000 Q100 or Q200 but no positive result at this point.

it seem i need to create a PLC Mcode for it..... but could it be done with hardeware PLC ?

Is there a better way to implement it ?


------------------------------------------------------------------------
how is MYCNC working with comment in gcode ?

linuxcnc : Comments & Messages

; (…) Comments
(MSG,…) Messages
(DEBUG,…) Debug Messages
(PRINT,…) Print Messages

mycnc
Posts: 763
Joined: Thu May 10, 2018 2:42 pm
Location: Ottawa, Canada
Contact:

Re: Manual tool change M660 ?

Post by mycnc »

Symbols ";" and () are used for comment in myCNC G-code parser

Code: Select all

;Comment Line
(Comment Line)
It's possible to set up custom popup messages in myCNC.

A popup message box is activated by writing "1" to register 9100...9163
Each register associated with a popup widget configured in Config -> Screen -> Popup Messages configuration widget

1) Set up the message box for Manual Tool Change
image.png
- Popup Message #50 is ID of the popup. To show the message need to write "1" to register 9150
- Popup message will be closed by pressing "OK" button
- Register 5409 contains "Next Tool" value. %d in Message line will be replaced by actual tool number you going to insert

2) Write "1" to register 9150 in manual Tool Change procedure
In the Macro G10 code line

Code: Select all

G10 L80 P9150 Q1
In PLC procedure gvarset command

Code: Select all

gvarset(9150,1);
Result will be like this
image.png
Popup widget size, position message text, font size and other parameters can be set according to your requirements

mycnc
Posts: 763
Joined: Thu May 10, 2018 2:42 pm
Location: Ottawa, Canada
Contact:

Re: Manual tool change M660 ?

Post by mycnc »

oursomatic wrote:
Sat May 16, 2020 11:11 pm
M1 is OK to paused the M6 procedure for manualy changing the tool in spindle.
I'd prefer to use an endless loop in PLC procedure waiting for pressing hardware button or software flag (through global variable register) when tool changed.

oursomatic
Posts: 18
Joined: Mon Mar 09, 2020 2:19 pm

Re: Manual tool change M660 ?

Post by oursomatic »

That is exactly what I need.

Because M01 is making conflict.

What do you do exactly with this one : gvarset(9150,1)

Where do you place it in PLC ?

Thk.

oursomatic
Posts: 18
Joined: Mon Mar 09, 2020 2:19 pm

Re: Manual tool change M660 ?

Post by oursomatic »

ok i understand how to popup the message with L10 only but in th e case of manual tool change how do i do "pause / re-start " to automatically stop the motion when i am removing the tool ?

i need an alternative of M0 because if insert M0 into my macro M6 i am not able to press start : because controller is busy / start program is blocked .

I can handle it into the running gcode with my processor but it is not a good solution when you have a PLC......

mycnc
Posts: 763
Joined: Thu May 10, 2018 2:42 pm
Location: Ottawa, Canada
Contact:

Re: Manual tool change M660 ?

Post by mycnc »

Could you describe the manual tool change sequence?

Is there a hardware button or the controller output to release/clamp a tool?
Are there input signals from spindle to the controller regarding tool clamped, no-tool etc?

Do you have a button connected to the controller input to resume a job after a manual tool change finished?

If you have all of this, then the PLC procedure (to wait for a manual tool change and resume a job) would be quite easy.

oursomatic
Posts: 18
Joined: Mon Mar 09, 2020 2:19 pm

Re: Manual tool change M660 ?

Post by oursomatic »

Not at all.
i just need M01.
I have no input / output relative to the manual tool change at this point of my retrofit
because i begin with Mycnc and my customer are waiting for me to start cutting again after 2 month off......

I really like to push on Cycle start button.
It is very convenient because you can do it from the touche screen or remote pendant or hardkey.
i have Hol-zher CNC with Sinumerik 810D control and this is how they did it.

------------------------------------------------------------------------------------------------------------------------------------

To be able to work, i did it into the gcode like that.
Wen tool change is needed, the machine go to the manual tool change position, display the message popup then wait for cycle start to continue and resume the message. i have intentionally removed M6 because i dont wannt to call a macro since i only use Tn.

--------------------------------------------------------------------
This kind of process is very usual on linuxcnc and mach3 or small controller because most of the user are not able to play with PLC / macro.

Code: Select all

(------------------------------)
(------------------------------)
(Tools used in this file: )
(Tool No.1 = Downcut Belin 3 mm)
(Tool No.2 = Downcut Belin 4 mm)
(Tool No.3 = Downcut Belin 5 mm)
(Tool No.4 = Downcut Belin 6 mm)
(------------------------------)
(------------------------------)
(X2440.000 Y1220.000 Z20.000)
(------------------------------)
(------------------------------)
(------------------------------)
T1
M5
G10 L80 P9150 Q1
G10 L80 P5521 Q1
G90 G53 G0 Z0 F5000
G90 G53 G0  Y1880
G4P2
M01
G10 L81 Q5409 P5400 
G10 L80 P5521 Q0
G10 L80 P9150 Q0
S5000M03
G04P10
(------------------------------)
(------------------------------)
(------------------------------)
G00 X158.654 Y865.691 Z30.000
G01   Z10.000 F4000
G01 X278.654   F8000
G03 X280.154 Y867.191 I0.000 J1.500 
G01  Y1027.191  
G03 X278.654 Y1028.691 I-1.500 J0.000 
G01 X158.654   
G03 X157.154 Y1027.191 I0.000 J-1.500 
G01  Y867.191  
G03 X158.654 Y865.691 I1.500 J0.000 
G00   Z30.000
(------------------------------)
(------------------------------)
(------------------------------)
T2
M5
G10 L80 P9150 Q1
G10 L80 P5521 Q1
G90 G53 G0 Z0 F5000
G90 G53 G0  Y1880
G4P2
M01
G10 L81 Q5409 P5400 
G10 L80 P5521 Q0
G10 L80 P9150 Q0
S5000M03
G04P10
(------------------------------)
(------------------------------)
(------------------------------)
G00 X158.932 Y656.970 Z30.000
G01   Z10.000 F4000
G01 X278.376   F8000
G03 X279.876 Y658.470 I0.000 J1.500 
G01  Y812.536  
G03 X278.376 Y814.036 I-1.500 J0.000 
G01 X158.932   
G03 X157.432 Y812.536 I0.000 J-1.500 
G01  Y658.470  
G03 X158.932 Y656.970 I1.500 J0.000 
G00   Z30.000
(------------------------------)
(------------------------------)
(------------------------------)
T3
M5
G10 L80 P9150 Q1
G10 L80 P5521 Q1
G90 G53 G0 Z0 F5000
G90 G53 G0  Y1880
G4P2
M01
G10 L81 Q5409 P5400 
G10 L80 P5521 Q0
G10 L80 P9150 Q0
S5000M03
G04P10
(------------------------------)
(------------------------------)
(------------------------------)
S5000
G00 X158.654 Y452.534 Z30.000
G01   Z10.000 F4000
G01 X278.654   F8000
G03 X280.154 Y454.034 I0.000 J1.500 
G01  Y584.034  
G03 X278.654 Y585.534 I-1.500 J0.000 
G01 X158.654   
G03 X157.154 Y584.034 I0.000 J-1.500 
G01  Y454.034  
G03 X158.654 Y452.534 I1.500 J0.000 
G00   Z30.000
(------------------------------)
(------------------------------)
(------------------------------)
T4
M5
G10 L80 P9150 Q1
G10 L80 P5521 Q1
G90 G53 G0 Z0 F5000
G90 G53 G0  Y1880
G4P2
M01
G10 L81 Q5409 P5400 
G10 L80 P5521 Q0
G10 L80 P9150 Q0
S5000M03
G04P10
(------------------------------)
(------------------------------)
(------------------------------)
S5000
G00 X153.654 Y184.804 Z30.000
G01   Z10.000 F4000
G01 X283.654   F8000
G03 X285.154 Y186.304 I0.000 J1.500 
G01  Y376.304  
G03 X283.654 Y377.804 I-1.500 J0.000 
G01 X153.654   
G03 X152.154 Y376.304 I0.000 J-1.500 
G01  Y186.304  
G03 X153.654 Y184.804 I1.500 J0.000 
G00   Z30.000
(------------------------)
(---------------------------)
(------------------------------)
G53G0Z0F5000 
G53G0X0Y0 
M5
M2
M30
(------------------------------)
(---------------------------)
(------------------------)

mycnc
Posts: 763
Joined: Thu May 10, 2018 2:42 pm
Location: Ottawa, Canada
Contact:

Re: Manual tool change M660 ?

Post by mycnc »

M660 PLC procedure is supposed to be a handler for manual tool change.
It shows a "Manual Tool Change" message, then waits in a loop till tool changed.
There can be a software flag (global variable register) indicating tool changed or
the procedure can wait till a hardware button (connected to the controller input) is pressed

Below is an example of a manual tool change handler M660.plc

Code: Select all

main()
{
  gvarset(1999,1); //set flag
  
  timer=0;
  flag=1;
  do{
    timer++;
    if ((timer&0xff)==0) //check every 0.25 sec
    {
      gvarset(9160,1); //show the Manual Tool Change Message #60
      flag=gvarget(1999); //check the flag, if flag<=0, then tool changed and a job should be resumed
    };
  }while(flag>0);

  gvarset(9160,0); //clear the Message
  exit(99);
};
Message #60 setup

image.png

When M660.plc is executed, a variable #1999 is set to "1" and the Popup Message shown.
image.png
Button on the popup message has action "cnc-gvariable-dec-1999".
When button "OK" on the popup message is pressed, the variable #1999 cleared to zero, and the procedure exits form the do-while loop.
Popup message is closed, M660 is finished and a job will be resumed.

Post Reply