Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 11:02:51 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Simple macro to activate output then deactivate it in MDI & Gcode?
Pages: 1   Go Down
Print
Author Topic: Simple macro to activate output then deactivate it in MDI & Gcode?  (Read 558 times)
0 Members and 2 Guests are viewing this topic.
natefoerg
Active Member

Offline Offline

Posts: 97


View Profile
« on: June 07, 2011, 10: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.
 
Logged
natefoerg
Active Member

Offline Offline

Posts: 97


View Profile
« Reply #1 on: June 08, 2011, 01:02:02 PM »

Anyone help me out?

Pretty please with sugar on top...
Logged
natefoerg
Active Member

Offline Offline

Posts: 97


View Profile
« Reply #2 on: June 08, 2011, 02: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...

Logged
natefoerg
Active Member

Offline Offline

Posts: 97


View Profile
« Reply #3 on: June 08, 2011, 04:00:10 PM »

Perhaps I should not have named it M99! M999 appears to work to make an output active...
Logged
BR549
Active Member

Offline Offline

Posts: 2,557


View Profile
« Reply #4 on: June 09, 2011, 11:05:20 AM »

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
Logged
natefoerg
Active Member

Offline Offline

Posts: 97


View Profile
« Reply #5 on: June 10, 2011, 08:46:55 AM »

Thanks BR549. The sleep was because I copied the code from somewhere else. It has been removed.

Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!