Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started 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.
-
you need a While Ismoving ()
Wend
Like this
ActivateSignal(Output1)
Code "G4 P0.5"
While Ismoving()
Wend
DeActivateSignal (Output1)
Hood
-
Just for your information you could also do
ActivateSignal(Output1)
Sleep(500)
DeActivateSignal (Output1)
Hood
-
Thanks Hood. I'll give that a try.
-
The sleep command shoiuld lower the load on your PC drastically.
Brett
-
Is the sleep duration in milliseconds?
-
Yes, so the 500 is equal to the 0.5 second you had in your example.
Hood
-
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)
-
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
-
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
-
I would imagine there are quite a few :)
Hood