Hello Guest it is November 27, 2021, 09:10:39 PM

Author Topic: Help with "dwell" in macro  (Read 5865 times)

0 Members and 1 Guest are viewing this topic.

Help with "dwell" in macro
« on: January 03, 2009, 01:23:53 AM »
I could use some help with a momentary signal to activate a relay on my mill.
In the M100 macro I put: 

ActivateSignal(Output1)
Code "G4 P0.5"
DeActivateSignal (Output1)

With the three lines of code I get no reading on my meter. I pretty sure I have everything else configured correctly. If I use just the first line "ActivateSignal(Output1)",
I get a solid 5v. reading. I've tried changing the dwell value, and double checked in General Config. that I'm not in millisecond mode. This is just a simple switch and is not related to any motion controls.
Any advise as to where I'm going wrong would be appreciated.

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Help with "dwell" in macro
« Reply #1 on: January 03, 2009, 05:13:10 AM »
you need a While Ismoving ()
Wend

Like this

ActivateSignal(Output1)
Code "G4 P0.5"
While Ismoving()
Wend
DeActivateSignal (Output1)


Hood

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Help with "dwell" in macro
« Reply #2 on: January 03, 2009, 06:38:15 AM »
Just for your information you could also do


ActivateSignal(Output1)
Sleep(500)
DeActivateSignal (Output1)

Hood
Re: Help with "dwell" in macro
« Reply #3 on: January 03, 2009, 06:54:50 PM »
Thanks Hood. I'll give that a try.

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Help with "dwell" in macro
« Reply #4 on: January 03, 2009, 07:18:46 PM »
The sleep command shoiuld lower the load on your PC drastically.

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Help with "dwell" in macro
« Reply #5 on: January 04, 2009, 12:26:50 AM »
Is the sleep duration in milliseconds?

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Help with "dwell" in macro
« Reply #6 on: January 04, 2009, 04:45:33 AM »
Yes, so the 500 is equal to the 0.5 second you had in your example.
Hood
Re: Help with "dwell" in macro
« Reply #7 on: January 04, 2009, 10:52:47 AM »
Where does the command 'Sleep' come from.  I looked in the VB-Script-Commands.pdf and every other document on Mach and could not find it. Is this an undocumented feature? thanks.

RJ

ps thanks Hood. have learned alot from your posts.  (and everyone else too)

Offline Hood

*
  •  25,838 25,838
  • Carnoustie, Scotland
    • View Profile
Re: Help with "dwell" in macro
« Reply #8 on: January 04, 2009, 10:55:59 AM »
Its always been in Mach but never worked correctly from what I gather, that is probably the reason its not been doccumented. Brian sorted it out a few revisions back and it seems to work perfectly now and drastically lowers CPU usage as Brett mentioned.

Hood
Re: Help with "dwell" in macro
« Reply #9 on: January 04, 2009, 11:08:31 AM »
Hi Hood, barely got the other posts read before your reply, thanks. Makes me wonder how many more of these 'undocumented' jewels are around. Like the g28.1 that I found.
RJ