Hello Guest it is April 16, 2024, 04:32:08 PM

Author Topic: Tool Sensor / Probe G31 assistance  (Read 10692 times)

0 Members and 1 Guest are viewing this topic.

Tool Sensor / Probe G31 assistance
« on: January 01, 2013, 04:06:00 PM »
I have been 'away' from my home CNC setup for quite a few months, due to work. 

I need help again with a few issues, and I'll start with my Tool Length Sensor or Probe (G31 code).  I did post about this subject a year ago but for some reason it's now not working!

Whilst I appreciate that there are plenty of threads relating to this subject, I find that most of them go into too much detail.

I need a simple macro to use with my Touch Plate which is connected to pin 15 and functioning correctly.  Below is the usual code that I have tried with my system. 

Firstly, it gives an error "Unknown word where unary operation could be Line 3". 

But...when running the code, it doesn't slow to the desired feedrate at Line 2 but keeps doing a rapid?  However, it does seem to trigger the probe but then it stops.

I'm sure this code used to work, when I was last at the machine but it was a few months ago.

This is the code I'm using...

Code "G0 X31.5 Y30.2.         // Position above touch plate
Code "G31 Z-50 F10".           // Slow until touch plate is found
While IsMoving()
Wend
code "G92 Z0"                       // Zero Z axis
code "G0 Z10"                       // Not sure if the rest is correct ??
While IsMoving()
Wend
code "G92 Z0"

Basically, I need the system to measure the length of Tool selected.  The bit I'm stuck with is what happens after the touch plate is found...I assume it needs to move back to the Home position and the length of tool will be known. 


I do have an ATC with six tools, but if anyone can help in adapting the above code so that it works on its own for now, that would be great.

Keith
Re: Tool Sensor / Probe G31 assistance
« Reply #1 on: January 01, 2013, 04:18:20 PM »
Get rid of the period at the end of the first line, and add a double-quote
Get rid of the period at the end of the second line

Regards,
Ray L.
Regards,
Ray L.
Re: Tool Sensor / Probe G31 assistance
« Reply #2 on: January 01, 2013, 04:32:58 PM »
Hi Ray,

Thanks for the prompt reply.  Apologies, but the quotes were just added to show that it is just G code and not VB.
the period was a mistake (my iPad !).  The actual code is....

G0 X31.5 Y30.2
G31 Z-50 F10
While IsMoving()
Wend
G92 Z10
While IsMoving()
Wend
G92 Z0

Just ran it again and it won't feed rate slowly.  It used to work fine but I can't think what I've done to the general Config settings to upset it!

Regards,

Keith
Re: Tool Sensor / Probe G31 assistance
« Reply #3 on: January 01, 2013, 04:59:11 PM »
OK.....  That makes no sense at all now.  You can't mix G-code and VB.  It is either G-code, OR it is VB, not both.  The first code you posted should work with the changes I suggested.  The second code you posted will not work at all.

Please post the EXACT code you are trying to run, NO CHANGES OR EDITS.

Regards,
Ray L.
Regards,
Ray L.
Re: Tool Sensor / Probe G31 assistance
« Reply #4 on: January 01, 2013, 05:40:49 PM »
Hi,

I am new to this, by the way!!

Right....I suspect that I was mixing VB Code and G Code!  I removed the While IsMoving and Wend lines and it now 'sort of works'.  It moves to above the sensor, rapids down 10 then moves down at 100 Feed rate until the sensor it touched (or switched).  I then back it off the switch by 30, then X0 Y0. 

But nothing seems to measure!  I expect it to measure the tool in the holder.

I think it will be a while before I understand all this, so I hope you don't mind assisting me?

Keith

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Tool Sensor / Probe G31 assistance
« Reply #5 on: January 01, 2013, 06:28:20 PM »
The code you have does NOT measure anything it just resets the Z offset to zero based on teh tool setter plus a Z offset.

(;-) TP
Re: Tool Sensor / Probe G31 assistance
« Reply #6 on: January 01, 2013, 06:35:06 PM »
Ah, I thought it did last time I used this code but it is a whole since!

Could you advise what I need in the code to actually measure the tool length, return to home and hence, give a daylight setting between the tip of the tool and the spoil board (where my sensor switch is placed)?

Thanks. K

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Tool Sensor / Probe G31 assistance
« Reply #7 on: January 01, 2013, 07:00:04 PM »
The code you listed IF it was used correctly probably did what you ask. As Ray pointed out the code you have listed right now will NOT run in either Gcode or VB.

To be a Gcode function it would be

G0 X31.5 Y30.2
G31 Z-50 F10
G92 Z10
G92 Z0



TO be a CB(VB)/ macro function it would be

Code"G0 X31.5 Y30.2"
Code"G31 Z-50 F10"
While IsMoving()
Wend
Code"G92 Z10"
While IsMoving()
Wend
Code"G92 Z0"
While Ismoving()
Wend
END


(;-) TP
Re: Tool Sensor / Probe G31 assistance
« Reply #8 on: January 03, 2013, 02:22:21 AM »
The excellent screen set by Ger, Mach3 2010, does everything you want to do. See the "Mach Screens" forum section.