Page 1 of 1

Change Feed Rate When Input High

PostPosted: Fri Feb 09, 2018 2:14 am
by chjade84
I am trying to redo my tool probe macro to be a little bit safer and more efficient so I have a sensor above my plate to tell the machine to slow down when it arrives there. I could probe at 3 IPM from max Z height but that would take forever. The idea, since tool length will always be different, is to have the tool trip the sensor some distance above the plate and then the feed rate will change from rapid to the appropriate rate for probing. This is the relevant portion; copied from another guy:

Sensor input is on port 2, pin 9.

if(dodualcycle)
{
exec.Code("G31 Z" + Zmin + "F" + FeedrateFast); // Do the Z probing with Fast feedrate first
while(exec.IsMoving()){}
exec.Wait(200);
exec.Code("G91 G0 Z" + retractforsecondmeasurement);
exec.Code("G00 G53 X" + probeX2 +" Y" + probeY2); // Move to the second probe sensor position in XY
exec.Code("G90");
}

I need something like "when pin 9 goes high, exec.Code("F10");" or something. Basically emulating the speed override input on the run page. I want to crank the speed down to like 2% of normal once that input goes high (therefore the tool tip is about an inch above the probe plate).

Is that possible? I've been staring at the manual but so far I haven't come up with anything.

Thanks!

Re: Change Feed Rate When Input High

PostPosted: Sat Feb 10, 2018 2:15 am
by chjade84
Ok, so I still haven't figured it out but I've got a short-term fix.

Code: Select all
exec.Code("G53 G01 F" + FeedrateFast + " Z-1");
for(; a < 24; a = a + 1 ) {

   SlowLED = AS3.GetLED(77);  //Check the Port2 Pin9 input "LED"
   if(SlowLED){                       
      a = 25;
   } else {
   exec.Code("G91 Z-0.75");
   
   }
   
   }
exec.Code("G91 Z-0.25 F10");
exec.Code("G90");
exec.Code("G31 Z" + Zmin + "F" + FeedrateSlow); // Do the Z probing again with Slow Feedrate to get a more accurate reading
while(exec.IsMoving()){}


I move the Z axis down 1 inch then do a loop where it moves 0.75 inches down and checks the sensor. If it doesn't see anything it will move down 0.75 inches again and so on - until it reaches 24 iterations of 0.75 inch moves. If it sees that the sensor is triggered, it will set the 'a' variable to 25 (above the loop limit) which exits the loop on the next go-around. It then moves down 0.25 inches to get a bit closer to the touch plate and then does the probing routine from that point.

It's obviously a jerky operation having all of those steps and checking the sensor. If there is a way to do it smoothly, I'd love to hear about it!

Re: Change Feed Rate When Input High

PostPosted: Fri Apr 06, 2018 6:16 am
by CADdy
Have you found a sensible solution? I'd like to hear it too.