Hello Guest it is March 28, 2024, 05:44:44 AM

Author Topic: Simple macro to activate output then deactivate it in MDI & Gcode?  (Read 15152 times)

0 Members and 1 Guest are viewing this topic.

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.
 
Re: Simple macro to activate output then deactivate it in MDI & Gcode?
« Reply #1 on: June 08, 2011, 02:02:02 PM »
Anyone help me out?

Pretty please with sugar on top...
Re: Simple macro to activate output then deactivate it in MDI & Gcode?
« Reply #2 on: June 08, 2011, 03:50:08 PM »
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...

Re: Simple macro to activate output then deactivate it in MDI & Gcode?
« Reply #3 on: June 08, 2011, 05:00:10 PM »
Perhaps I should not have named it M99! M999 appears to work to make an output active...

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Simple macro to activate output then deactivate it in MDI & Gcode?
« Reply #4 on: June 09, 2011, 12:05:20 PM »
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
Re: Simple macro to activate output then deactivate it in MDI & Gcode?
« Reply #5 on: June 10, 2011, 09:46:55 AM »
Thanks BR549. The sleep was because I copied the code from somewhere else. It has been removed.

Re: Simple macro to activate output then deactivate it in MDI & Gcode?
« Reply #6 on: December 19, 2012, 04:39:57 PM »
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