Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: ASC on March 07, 2011, 01:17:13 PM

Title: SystemWaitFor help... Need Mach to wait for a signal!
Post by: ASC on March 07, 2011, 01:17:13 PM
Hey guys, embarking on another fun Mach project and I've hit a snag.

The system is going to be a pick, place and solder machine with integrated dispensing of adhesive and solder paste.  I'm trying to use Mach to control the motion and a PLC to control the actuators and timing for the pick/place/solder head.

I've tried writing a macro that does the following:
1)turns on a Mach3 output that enables the PLC
2)waits until a PLC output triggers a Mach3 input before motion can continue

here is said macro:
 
ActivateSignal(output1)   'triggers PLC to start PICK cycle
Sleep(100)
DeactivateSignal(output1)
SystemWaitFor(input1)    'PLC program is complete, Mach may continue


So far everything works, Mach moves the system to its specified coordinates, the halts and the PLC program executes, however when it is complete, the system is stopped.  I can see input 1 being triggered on the diagnostics page but the macro never completes.  Am I executing the systemwaitfor command improperly?

Any suggestions or ideas are more than welcome!

Title: Re: SystemWaitFor help... Need Mach to wait for a signal!
Post by: Overloaded on March 07, 2011, 02:04:04 PM
ActivateSignal(output1)   'triggers PLC to start PICK cycle
Sleep(100)
DeactivateSignal(output1)
SystemWaitFor(input1)    'PLC program is complete, Mach may continue
DoOEMButton 1000

Might put this at the end and try it.
Title: Re: SystemWaitFor help... Need Mach to wait for a signal!
Post by: ASC on March 07, 2011, 03:14:46 PM
That did do it!  Also found that manually pressing the start button allowed it to continue.  This is much better though as I want this machine to run with as little operator input as possible.

Also I figured out a work around macro;

ActivateSignal(output1) 'triggers PLC to start PICK cycle
While IsActive(input1)
Wend
DeActivateSignal(output1)

This works the same as the previous script as long as input1 is set to active low!