Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: jwhalin on June 09, 2014, 09:56:59 AM

Title: using control panel buttons to exicute a series of MDI commands
Post by: jwhalin on June 09, 2014, 09:56:59 AM
I do not have an ATC or dedicated tool holders, so I must reset "Z" every time I change tools. I do this using the MDI and a single-side PCB connected to the PROBE input. Works great, but is very repetitious.
Is there a way to put an MDI script behind a Button (like the “GO TO” which I have never used)
A few simple lines would do: (I don't need the comments)

(Move Z above the top surface and hold the PCB in place – press GO TO)
G92 Z0.0       ;reset Z
G31 Z-0.5 F1   :probe
G92 Z0.059    ; re-ZERO to PCB thickness
G0 Z1.0      ;clear Z
M2

This would be fast, and also prevent typos causing problems. I would not have to switch screens to get to the MDI and then back to continue the program.
I think it would work with the main GCODE program running at a M1 or Tool change line. (it does when I do it manually)

Thanks,
Jeff
Title: Re: using control panel buttons to exicute a series of MDI commands
Post by: Graham Waterworth on June 10, 2014, 11:00:42 AM
You could write the code into a M code macro and call it from mdi, putting the code into a button can be very dangerous unless al the right checks are included.  This it the format the code needs for a macro :-

Code ("G92 Z0.0")
Code ("G31 Z-0.5 F1")
Code ("G92 Z0.059")
Code ("G0 Z1.0")

Save this as M2222.m1s in the macros folder of your current profile and call it with m2222 in mdi

It may need fine tuning.