Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: natefoerg on June 07, 2011, 11:48:01 PM
-
I am trying to write a VB script (macro I believe they are called) That will open and close my air collet closer.
I already have Mach3 running a Macro that runs a toolchanger. this is air operated, and uses one solenoid and a stepper motor.
I have a M06 macro running it that uses this command " ActivateSignal(OutPut2)" and also uses DeActivateSignal(OutPut2) one allows the solenoid to pressurize the air cylinder and the other depressurises it.
How can I write a macro that does this-
(I want to call it something like M101)
I want to be able to either MDI a command like CC0 for (collet closer open) and CC1 for (collet closer closed) or to have CC0 or CC1 placed into my Gcode file.
I want CC0 to ActivateSignal(OutPut3) and CC1 to DeActivateSignal(OutPut3)
I believe that I need to have the Macro stored in C/Mach3/Macros/Mach3Turn. Is this correct?
I know how to wire the solenoids, plumb the air, configure Mach ports&pins for the outputs, but for the life of me I cant figure out how to write this macro. It seems like it should be so easy, but I cant figure it out.
Any input you can provide would be great!
Best,
Nate.
-
Anyone help me out?
Pretty please with sugar on top...
-
So I have been trying lots of things. Reading everything I can find and I thought I might be able to do this-
Write a macro called M99
ActivateSignal(OUTPUT2)
Sleep 100000
Store that macro in C/Mach3/Macros/mach3turn/m99.m1s
Execute this Macro by typing m99 into the MDI box.
I have tried this and it does not activate the output led on the diagnostics page.
Here is my output configuration-
Output number 1 (checked) Port 1 Pin 16 Active low (unchecked)
Any thoughts? I suspected that this macro would activate the output, but I have had no luck yet...
-
Perhaps I should not have named it M99! M999 appears to work to make an output active...
-
YOU need to use a M# higher than M100. Below that is reserved for internal use.
You are on track just remember in your Gcode side you will be required to use a MACRO call as anything like CC0 or CC1 is not allowed
M100 open , M101 close
WHy the LONG sleep? That would be 100 seconds .
Just a thought, (;-) TP
-
Thanks BR549. The sleep was because I copied the code from somewhere else. It has been removed.
-
I noticed that your macro is to activate output 2 and you setup you said output 1 port 1 pin 16. You should enable output 2 to work with your macro.
just an opinion.
Be happy.
thanks
darli