Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 02:09:41 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
| | |-+  Simple pause for testing macros
Pages: 1   Go Down
Print
Author Topic: Simple pause for testing macros  (Read 931 times)
0 Members and 1 Guest are viewing this topic.
Jeff_Birt
Active Member

Offline Offline

Posts: 809




View Profile WWW
« on: September 10, 2008, 01:26:30 PM »

I needed to create a pause in a macro to test that a plug was receiving a flag that indicated spindle mode. Basically at the start of the tool change macro M6Start, a flag is lowered to signal that the spindle drive should switch to tool change mode. After all the tool change stuff takes place the flag is raised to signal run mode. I just needed a way to add a delay between the flag states to test that the plug-in was handling the flags properly. I searched for a pause command but did not find anything so I whipped up the following and thought it might be helpful to others. Please note having a pause in a macro like this, while useful for testing, is a bad idea in production code.

  DeActivateSignal(17)
 
  tool = GetSelectedTool()
  SetCurrentTool( tool )

  Dim TS As Single ' Start time
  Dim ET As Single ' Elapsed time
  Dim waiting As Boolean ' loop flag
 
  TS = Timer ' current time in seconds
  waiting = true ' we start out waiting
 
  While waiting
    ET = Timer
    If ET > TS + 30 Then ' the "30" is the # seconds delay
       waiting  = false
    End If
  Wend
 
  ActivateSignal(17)
Logged

Happy machining , Jeff Birt
 
Bodini
Active Member

Offline Offline

Posts: 112



View Profile
« Reply #1 on: September 10, 2008, 03:36:59 PM »

Jeez, I feel like I'm reading this wrong but... "G4 p30"?
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!