Hello Guest it is November 20, 2019, 02:10:23 AM

Author Topic: SystemWaitFor help... Need Mach to wait for a signal!  (Read 3527 times)

0 Members and 1 Guest are viewing this topic.

Offline ASC

*
  •  59 59
    • View Profile
    • Automation Systems
SystemWaitFor help... Need Mach to wait for a signal!
« 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!

Mr. Creosote
Re: SystemWaitFor help... Need Mach to wait for a signal!
« Reply #1 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.
« Last Edit: March 07, 2011, 02:07:45 PM by Overloaded »

Offline ASC

*
  •  59 59
    • View Profile
    • Automation Systems
Re: SystemWaitFor help... Need Mach to wait for a signal!
« Reply #2 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!
Mr. Creosote