Change Feed Rate When Input High

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Change Feed Rate When Input High

Postby chjade84 » Fri Feb 09, 2018 2:14 am

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!
chjade84
 
Posts: 17
Joined: Wed Sep 21, 2016 4:46 pm

Re: Change Feed Rate When Input High

Postby chjade84 » Sat Feb 10, 2018 2:15 am

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!
chjade84
 
Posts: 17
Joined: Wed Sep 21, 2016 4:46 pm

Re: Change Feed Rate When Input High

Postby CADdy » Fri Apr 06, 2018 6:16 am

Have you found a sensible solution? I'd like to hear it too.
CADdy
 
Posts: 148
Joined: Sun Sep 17, 2017 2:26 pm


Return to Macros

Who is online

Users browsing this forum: No registered users and 4 guests

cron