Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 09:34:51 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Stop a macro several times with M01 and/or SystemWaitFor (Start)
Pages: 1   Go Down
Print
Author Topic: Stop a macro several times with M01 and/or SystemWaitFor (Start)  (Read 699 times)
0 Members and 1 Guest are viewing this topic.
FrankL
Active Member

Offline Offline

Posts: 3


View Profile
« on: July 10, 2008, 12: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

Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 770


Briceville, TN, USA



View Profile WWW
« Reply #1 on: July 10, 2008, 09:24:12 PM »

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
Logged

All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
FrankL
Active Member

Offline Offline

Posts: 3


View Profile
« Reply #2 on: July 11, 2008, 12:02:41 AM »

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.
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Online Online

Posts: 770


Briceville, TN, USA



View Profile WWW
« Reply #3 on: July 11, 2008, 01:17:19 AM »

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
Logged

All things Mach3, Screens, Wizards, Plugins, Brians, complete control solutions for complex machines, Macros, ATC's, any kind of CNC machine build, retrofit or repair.
FrankL
Active Member

Offline Offline

Posts: 3


View Profile
« Reply #4 on: July 11, 2008, 02:17:10 AM »

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.
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!