Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: ASC on July 22, 2010, 11:38:57 AM

Title: controlling outputs through g-code
Post by: ASC on July 22, 2010, 11:38:57 AM
Hey guys, I'm having trouble wrapping my stupid head around Mach's control of outputs.  I have a mill with a spindle and a dispenser mounted on separate air actuators to move them into the work area and act as a float.  I want Mach to be able to switch these actuators on and off when they're needed through the g-code.  Has anyone had any experience with an application like this, or can anyone recommend a visual basic script to get me started?
Title: Re: controlling outputs through g-code
Post by: Hood on July 22, 2010, 12:35:04 PM
Open  notepad and type in your VB, for example to switch on OutPut 3 you would have

ActivateSignal(OutPut3)

Save the file as m****.m1s where the **** is a number you wish, for example it could be m1234.m1s.
Yousave it to the macro folder of the profile you are using, exaple if using standard Mach3Mill profile it would be saved to
C:\Mach3\macros\Mach3Mill

Then when you have m1234 in your code or call from MDI that output will be activated. Similarly for shutting it off write another macro as above and call it for example m1235.m1s. In the macro you would have

DeActivateSignal(OutPut3)

So when your code calls m1235 the output will switch off.
Hood
Title: Re: controlling outputs through g-code
Post by: ASC on July 22, 2010, 01:06:51 PM
thanks Hood!  Seems so simple once someone knowledgeable explains it!  ;D
Title: Re: controlling outputs through g-code
Post by: LarryL on October 30, 2010, 01:14:25 PM
Hey Hood,

A macro question for you!  Is there a way to constantly provide the updated position of an axis so that it can be acted upon by an if then operation?

Larry
Title: Re: controlling outputs through g-code
Post by: Hood on October 30, 2010, 07:19:58 PM
The macropump or a Brain may be able to but depends I suppose what you actually are wanting to do.
Hood