Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: jdgriffin on January 03, 2009, 01:23:53 AM

Title: Help with "dwell" in macro
Post by: jdgriffin 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.
Title: Re: Help with "dwell" in macro
Post by: Hood 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
Title: Re: Help with "dwell" in macro
Post by: Hood on January 03, 2009, 06:38:15 AM
Just for your information you could also do


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

Hood
Title: Re: Help with "dwell" in macro
Post by: jdgriffin on January 03, 2009, 06:54:50 PM
Thanks Hood. I'll give that a try.
Title: Re: Help with "dwell" in macro
Post by: Chaoticone on January 03, 2009, 07:18:46 PM
The sleep command shoiuld lower the load on your PC drastically.

Brett
Title: Re: Help with "dwell" in macro
Post by: jdgriffin on January 04, 2009, 12:26:50 AM
Is the sleep duration in milliseconds?
Title: Re: Help with "dwell" in macro
Post by: Hood 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
Title: Re: Help with "dwell" in macro
Post by: RJ Hohman 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)
Title: Re: Help with "dwell" in macro
Post by: Hood 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
Title: Re: Help with "dwell" in macro
Post by: RJ Hohman 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
Title: Re: Help with "dwell" in macro
Post by: Hood on January 04, 2009, 12:00:20 PM
I would imagine there are quite a few :)

Hood