Hello Guest it is April 24, 2024, 06:29:47 PM

Author Topic: Difference between Macro and Button Script?  (Read 11274 times)

0 Members and 1 Guest are viewing this topic.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Difference between Macro and Button Script?
« Reply #10 on: March 04, 2013, 11:42:25 AM »
If not response time, why should probing precision depend on feed rate?
You're the hardware guy - you tell me  ;D

The presumption you offered is one I've heard before but as I've said is not one I agree with. This is how I satisfied myself long ago that it's not the case.

Take a microcontroller dev board (PIC, ATMEL whatever you like) and program it to count a number of interrupts on the pin of your choice. Connect the axis step pin from Mach to that interrupt pin. I set it to count an arbitrary 50,000 step pulses but it doesn't matter. When it hits that 50,000 count, program it to activate an output pin connected to the probe in pin of Mach.

Now send the axis to 0, reset the microcontroller, then do a G31 Z(whatever) that takes it to a position BEYOND 50,000 step pulses on YOUR system. Have the gcode var monitor open looking at var 2002. If all is set up correctly you'll see a value in 2002 that is the trip point and represents the distance YOUR system travels for 50,000 step pulses. Now repeat at your leisure at ANY feedrate you like. The value in 2002 will ALWAYS be the same and as I've said will be the distance Mach traveled when it tripped.

I hope you'll agree this models a probe that trips at the exact same position every time and thus takes out of the equation any mechanical issues. It also proves that Mach's ability to read the probe trip AND store that position is INDEPENDANT of feedrate.

Cheers

Ian

 
Re: Difference between Macro and Button Script?
« Reply #11 on: March 05, 2013, 06:56:58 AM »
OK, well the mystery is beyond me for the moment!

As for my macro, I have removed the "goto label" horror as the feature didn't seem to be needed anyway and done some other tidying up.  It now basically works as a macro called from G code or the MDI.  Pasting the code as button code still didn't work UNLESS it was single stepped, in which case it worked perfectly.  Maybe there is a timing issue when running CB code from a button?  So I tried an alternative approach, and wrote one line of button code that called the macro (correctly this time!) and now it works perfectly from the button too.

Now to write some edge-finding macros to zero the X and Y axes...

Thanks for yoyr help,

John.