Machsupport Forum
		Mach Discussion => VB and the development of wizards => Topic started by: FrankL on July 10, 2008, 01:23:51 AM
		
			
			- 
				Hi,
I have been looking at various posts regarding this, but I just can't find why the following code is not running correctly no matter how the "Stop on M1 command" is set in the General Config panel or if I use the button on the main screen.
In the code below, the 1st M01 command is ignored and the 3rd pause is not working at all. If I comment out the 1st M01 and use the 1st SystemWait, then I can stop on the 1st pause but then the second / 3rd pauses are ignored.
Any idea on why and how to get this to work ?
Thank you
(I'm running Mach3 v3.041 on XP)
=============
Sub Main()
'Test Stop on M01
Code "M01"            'sets a machine pause
Code "(Press Start to continue - 1)"   'this goes in the status bar
'SystemWaitFor (Start)
'Code "M01"            'sets a machine pause
Code "(Press Start to continue - 2)"   'this goes in the status bar
SystemWaitFor (Start)
Code "M01"            'sets a machine pause
Code "(Press Start to continue - 3)"   'this goes in the status bar
'SystemWaitFor (Start)
Code "(End)"            'this goes in the status bar
End Sub
			 
			
			- 
				Here is your code.
SystemWaitFor, only works for REAL inputs, so your gonna have to bring in a true input.
here is the code:
Sub Main()
'Test Stop on M01
ReStart = IsActive(INPUT4)            'this is input signal 4
DoOEMButton(1001)                    'sets a machine pause
Message("Press Start to continue - 1")  'this goes in the status bar
SystemWaitFor (ReStart)
DoOEMButton(1001)                     'sets a machine pause
Message("Press Start to continue - 2")  'this goes in the status bar
SystemWaitFor (ReStart)
DoOEMButton(1001)                     'sets a machine pause
Message("Press Start to continue - 3")  'this goes in the status bar
SystemWaitFor (ReStart)
Message("End")                     'this goes in the status bar
End Sub
Scott
			 
			
			- 
				Hi Scott, 
Thank you very much for your answer and the code.
I'm new to this but I thought SystemWaitFor (Start) was waiting for the main Start button. That's why I was trying this too. I understand now it's a variable and how that can be used.
But this is to be used in a m6End macro where I want to stop several times and display an operator message. And no real input is available (one could be made available with a manual switch but I am already short in the nb of inputs with the HobbyProCNC board, so ...). And I really don't like the idea of having 2 different  "Start" buttons. 
So, how do I get M01 to stop and restart ? Or saying it differently, how do I pause (temporarily stop/resume) a macro operation several times and still/only use the main Start button ?
Thanks again for your help.
			 
			
			- 
				you need to spell out what you want to happen, step by step, I dont understand what you want.........
m1 is already an optional stop/pause, and to start running again, you just hit the cycle start button.....
scott
			 
			
			- 
				Thank you for your patience on this.
WITHIN the M6End.m1s process that I have up and running correctly (auto tool zero with a contact plate), I like to pause the macro several times and display operator messages like :
- now change tool, click Start when done
- now position plate and connect lead to bit, click Start when done
- now disconnect lead and remove plate, click Start when done
On this last Start, then the M6End macro would end and the tool returns to normal operation.
I have all the code that takes care of the X,Y,Z positions, before and after the tool change, up and running. I just can't stop and get the various messages out when I want while executing the M6End. So, how do I pause and restart (with the main Start button) within a macro
I hope it's clear.