fsli wrote:dhanger wrote:I also tried setting an input trigger for the 2 sensors with a trigger of 130 (cycle stop)
Dan,
I think you're on the right path here. If the motion command is ignoring the Cycle Stop signal, then I'd suggest trying other triggers which should force motion to stop.In addition, after your while(exec.Ismoving()) loop, you'll want to check the exec.Ismacrostopped() flag to prevent continuing your macro statements if a crash happened.
- Set the input trigger to the Reset button (144).
- Assign the input pin to one (or both) probe inputs on the settings page, and enable safe probe mode in the macro.
- Couple the crash sensor to the e-stop circuit (after all, crashing into something would certainly qualify as an emergency).
- Couple the crash sensor to an axis limit circuit.
dhanger wrote:It seems pointless to rely on the while loop for anything after the the exec.code command as long as it's not even referenced until the move is completed
// Get the machine moving.
exec.Code("G1 F100 G53 Z2");
// Idle loop to wait for motion to stop.
while (exec.Ismoving()) ;
// If the motion command was interrupted (presumably by the crash sensor, but
// could be for other reasons) or the crash sensor pin is raised, then exit the macro.
if (exec.Ismacrostopped() || !AS3.GetLED(in_pullSensor_pin))
{
MessageBox.Show("Tool not released! Stopping tool change.");
return;
}
System.Timers.Timer StateTimer;
StateTimer = new System.Timers.Timer(10);
StateTimer.Enabled = false;
StateTimer.Elapsed += UpdateStatus_Event;
StateTimer.AutoReset = true;
exec.Codesync("G0 G53 Z0");
Console.WriteLine("Code running");
StateTimer.Enabled = true;
exec.Code("G01 f100.0 G53 Z-3");
StateTimer.Enabled = false;
Console.WriteLine("Out of the loop");
if (exec.Ismacrostopped())
Console.WriteLine("Stopped");
while(exec.IsMoving()) ;
#Events
int cnt = 0;
void UpdateStatus_Event(Object source, System.Timers.ElapsedEventArgs e)
{
Console.WriteLine("Check inputs");
if (++cnt == 20)
exec.Callbutton(130);
}
dezsoe wrote:Well, it's strange, but exec.Code really don't return before finishing the G1.
Users browsing this forum: No registered users and 15 guests