If the program you're running is really that simple, you could do the whole thing in a macro:
TRIGGER_IN = OEMTRIG1 ' Mach3 signal to trigger code execution
ACKNOWLEDGE_OUT = OUTPUT1 ' Mach3 signal to send acknowledge at end of execution
While 1
' Wait for input, when true...
WaitForTrigger()
Code "G01 X0.6 F2.0"
Code "G01 X1.2 F10.0"
' Pulse output
SendAcknowledge()
' Wait for input, when true...
WaitForTrigger()
G01 X0.6 F2.0
G01 X0.0 F10.0
' Pulse output
SendAcknowledge()
' Wait for input, when true...
WaitForTrigger()
G01 X0.6 F2.0
G01 X1.2 F10.0
' Pulse output
SendAcknowledge()
Wend
Sub WaitForTrigger()
While IsActive(TRIGGER_IN) = 0
Sleep 100
Wend
End Sub
Sub SendAcknowledge()
ActivateSignal(ACKNOWLEDGE_OUT)
Sleep 100
DeactivateSignal(ACKNOWLEDGE_OUT)
End Sub
You can put the above code into a file named M999.m1s ("999" can be any number over 100) in the Mach3\macros\<YourProfileName> directory. Then, typing M999 on the MDI line, or in a G-code program, will run the macro. Since it's an endless loop, you'll have to use E-Stop or ESC to terminate it. Alternatively, you can put the WaitForTrigger subroutine into M998.m1s, and the SendAcknowledge subroutine into M999.m1s, then use M998 in your G-code when you want to wait for the external trigger to be asserted, and M999 when you want the acknowledge to be sent.
Regards,
Ray L.