MechMate CNC Router Forum

Go Back   MechMate CNC Router Forum > Computing, Software & Programming > CNC motion control software
Register Options Profile Last 1 | 3 | 7 Days Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old Sun 08 February 2009, 10:23
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Mach3 Macros for output signals

I can't believe that I was so dense when it came to writing macros to control the outputs in Mach3. (Maybe everyone but me already understands Mach3 macros and output signals, but I surely didn't.)

When I looked at the documentation sheet for the Gecko G540, it said that OUTPUT2 was pre-assigned to DB-25, pin 1. That is not a usable output pin on the PMDX-122. All at once the proverbial light came on and I realized that I had been making Mach3 much too difficult.

I clicked on Config -> Ports and Pins -> Output Signals and then Enabled Output #1, assigned it to Port 1 (default) and Pin Number 17. Then I clicked Active Low. Next I Enabled Output #2, assigned it to Port 1 (default) and assigned it to Pin Number 1. Then I clicked Active Low. At that point, Mach 3 was configured to handle the two Gecko G540 outputs.

The goal was to have simple control over the outputs. I wanted to be able to turn an output on and then to be able to turn an output off by using M-codes.

I decided to use Mach3's VBScript Editor to write the macros, so I clicked Operator -> VBScript Editor and entered this one line of code:

ActivateSignal(OUTPUT1)

I saved it as M801.mls

I wrote three other macros:
M802.mls contains one line: ActivateSignal(OUTPUT2)
M901.mls contains one line: DeactivateSignal(OUTPUT1)
M902.mls contains one line: DeavtivateSignal(OUTPUT2)


So, I ended up with four macros, M801, M802, M901 and M902. I could have used any permissible number.

- M801 turns on the G540's Output #1.

- M802 turns on the G540's Output #2.

- M901 turns off the G540's Output #1.

- M902 turns off the G540's Output #2.

All the macros were saved in the C:\Mach3\macros\Mach3Mill directory. All four macros have .mls as the suffix.

Next, I wrote a test program and saved it as junk.tap. All that the program does is to call a subroutine 10 times to move the X-axis, turn on Output #1, wait for 2.5 seconds, turn on Output #2, wait for 2.5 seconds, turn off Output #1, wait for 2.5 seconds, turn off Output #2 and wait for 2.5 seconds. (Be sure to set G04 to ms in the General Logic Configuration screen - or you'll be waiting for 2500 seconds). As the program ran, I watched the Output LEDS on the Diagnostics screen - and it worked!

G90

M98 P0100 L10
M30

O0100
G01 X5 F600
G04 P50
G00 X0
M801
G4 P2500
M802
G4 P2500
M901
G4 P2500
M902
G4 P2500
M99


Anyway, that's all that there is to it. Just assign the Outputs to a usable pin number, write a macro to turn on the output, ActivateSignal(OUTPUTx), write a macro to turn off the output, DeactivateSignal(OUTPUTx), and then call the macros using the appropriate M-code.

Last edited by Richards; Sun 08 February 2009 at 10:31..
Reply With Quote
  #2  
Old Sun 08 February 2009, 18:07
sailfl
Just call me: Nils #12
 
Winter Park, FL
United States of America
Mike,

You just turned a light on for me. I did not know you could put a macro call in the GCode. It makes sense now but I didn't think of it. Now I am going to have to see how I can use the idea.

What are you doing with the macros that you want them to run while you are cutting?

Thanks
Reply With Quote
  #3  
Old Mon 09 February 2009, 03:44
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Nils,

I'm thinking about using an air-drill mounted to a PHD pneumatic slide on the Z-axis. One output would extend the pneumatic slide below the regular Z-axis cutter so that the Z-axis could be used to actually move the drill down/up. The other output would turn the air-drill on/off for each hole. Gary Campbell in Florida uses that type of design on his Shopbot and Ron Stephenson in Idaho uses that type of design on his custom-made CNC router. Most air-drills are air hogs, so you only want to have them turned on for the shortest possible length of time when drilling a hole.
Reply With Quote
  #4  
Old Mon 09 February 2009, 04:16
sailfl
Just call me: Nils #12
 
Winter Park, FL
United States of America
Mike,

I am interested in learning more. I also would like to build Gary's Air Drill. He uses a SCM pneumatic slide. I blew up some of his photos that he sent to me. I found the slide on EBay though I have not bought one. I know nothing about pneumatics but I am very interested. I also talked to a SCM rep about their tables.

Any information you have that you can pass my way I will appreciate. Is there any thing I can do to help.

Do you have a link to Ron's build?

Have you seen Gary's pneumatic hold down system. I think it is fairly new. Gary is going to do a write up on it soon. I am interested in looking at that also.
Reply With Quote
  #5  
Old Mon 09 February 2009, 08:16
jhiggins7
Just call me: John #26
 
Hebron, Ohio
United States of America
Mike,

YOU RULE!

That is a very helpful tutorial. I've searched the forums and the Mach3 documentation...and after all that you answer my questions with a simple example. Well done!

Regards,
John
Reply With Quote
  #6  
Old Mon 09 February 2009, 09:10
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Mike,
Thanks for your contributions Do you do anything other than CNC?
Reply With Quote
  #7  
Old Mon 09 February 2009, 09:22
Gerald D
Just call me: Gerald (retired)
 
Cape Town
South Africa
Mike may be too modest to mention this one:
http://www.cnczone.com/forums/showthread.php?t=36846
Reply With Quote
  #8  
Old Mon 09 February 2009, 09:52
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Nils,

Some Shopbot users found that the air-drill supplied by Shopbot had some unexpected problems, mostly due to the fact that air compresses which sometimes kept the air-drill from drilling to the expected depth. Gary Campbell and Ron Stephenson solved that problem by installing their air drill(s) onto a slide that attached to the Z-axis.

Think of a 'slide' as being a linear rail with a pneumatic cylinder attached. The linear guide portion of the slide assures accurate movement to whatever is attached to the slide (air-drill assembly). Gary and Ron attached the slide in such a way that when the slide was extended, the drill extended below the normal cutter far enough that the normal cutter would not touch the material. When the slide was retracted, the drill was raised high enough so that it would not touch the material even when the normal cutter was at full depth.

I don't know what size slide/air cylinder Gary currently uses, but Ron has an air-cylinder that gives over 200 lbs of force. Some may think that 200 lbs of force is too much, but, remember, air compresses. If you're drilling shelf-pin holes that are only 0.375 inches deep and the drill/cylinder compresses only 0.125 inch, those holes will not be deep enough.

In operation, when they need to drill holes, they raise the Z-axis to the drill's 'safe height' and extend the slide/cylinder. Gary had proximity sensors on his first design to assure that the slide was properly extended and properly retracted. I don't know if he uses them on his current design. They seem like a very good idea to me. Once the slide/cylinder is fully extended, they use the Z-axis to drill the holes. Because they use an air-drill, they turn on the air to the drill before the drill touches the material and they turn off the air to the drill after the drill exits the material.

A minimal safe system would require two outputs and two inputs. One output would extend/retract the slide/cylinder and the other output would control the air to the drill. One input would sense when the slide/cylinder was in its raised/top position and the other input would sense when the slide/cylinder was in its lowered/down position.

New slides/cylinders and air drills are pricey, but there are vendors on E-Bay that consistently sell pneumatic slides that have been removed from working equipment.

A fully equipped CNC router would have one spindle and two air drills. A good quality compression cutter would be installed in the spindle. One air drill would have a 5mm drill for drilling shelf-pin holes and one air drill would have an 8mm drill for drilling system holes. With that set-up, no tool changing would be required and maximum productivity could be achieved at less expense for the manual spindle and two air drills than it would cost to just by a spindle capable of auto tool changing.
Reply With Quote
  #9  
Old Sun 10 January 2010, 18:11
Robert M
Just call me: Robert
 
Lac-Brome, Qc
Canada
Send a message via Yahoo to Robert M Send a message via Skype™ to Robert M
Hi Mike ( or anyone else ! )

Very Newbee with Mach3 controls for the MM Controller box.
I’m still at the “Kitchen project” level and been reading, reading and so on, on how to get Mach3 to activate (On) or Off the pmdx relay ( J7 )
A - Is this how it should be done or an alternative to ?
B - How most other get there router on / off my Mach3 ? ( maybe showing me the link on this if ever it's been coverd by...can't find it )
Thanks helping me with this… Robert
Reply With Quote
  #10  
Old Sun 10 January 2010, 18:59
Robert M
Just call me: Robert
 
Lac-Brome, Qc
Canada
Send a message via Yahoo to Robert M Send a message via Skype™ to Robert M
A little precision in my question « B »
I’ve read many places about relay set up port 1 pin 1 and getting “on or off” by M3 & M4…. Or Art’s way by M3 & M30…. Where are those ?? is more the question… are those a Macro ?

So to minimize confusion, let’s see this one as question “C - ”
Sorry & thanks again, Robert
Reply With Quote
  #11  
Old Sun 10 January 2010, 23:01
Gerald D
Just call me: Gerald (retired)
 
Cape Town
South Africa
Robert, Mike has informed me that he will no longer be posting at the MM forum and so it is unlikely that you will get a reply to your posts. (It is a private matter).
Reply With Quote
  #12  
Old Mon 11 January 2010, 04:43
Robert M
Just call me: Robert
 
Lac-Brome, Qc
Canada
Send a message via Yahoo to Robert M Send a message via Skype™ to Robert M
Thanks for advising Gerald !
That is not a so good news…I & MANY others will miss Mike around here ….pita

Although I’m addressing my question to Mike first, Could I ask you to give me a hand on this one ?
Trying to get my router on & off and having a hard ( or should say rather a lengthy reading on it ) and still cannot find how to either make it go on & off manually, or part of a demo G-code like the “Road Runner” as we can notice on the 3rd line, there is this “M3” code and yet, no “On” of my router circuit, but when I go in “Port’s & Pins” under “Output Signals” and either check or Un-check the active low it goes “On or Off” making my believe I got it all hook up right….but just can’t find out how to make it go on & off by this demo G-code or manually on the “program Run” screen ??

I’m a little lost on this one and even through some few hrs of reading & searching out on the ArtSoft forum, just can’t find out a solution to my quest.
So…. Long one to say or ask, anyone can help, Mike no longer around here !
Amicalement, Robert
Reply With Quote
  #13  
Old Mon 11 January 2010, 05:02
Gerald D
Just call me: Gerald (retired)
 
Cape Town
South Africa
Look at post #37, and some before and after that post, in this thread:
Solid State Relay (SSR) for switching Router under control of Mach3
Reply With Quote
  #14  
Old Mon 11 January 2010, 05:18
Robert M
Just call me: Robert
 
Lac-Brome, Qc
Canada
Send a message via Yahoo to Robert M Send a message via Skype™ to Robert M
Thanks for the prompt reply Gerald….
Maybe it’s me, but re-read it again this morning, even after reading it a few time yesterday & before, yet, cannot find how
A – how to activate it manually ( on & off) from the mains screen
B - Isn’t a way you guys can activate this relay manually from either the main screen or any other screnn for that matter ??
C – out of the demo road runner, after line 3 ( as the line tree is this M3 macro) no “On” activation of my router circuit…WHY ???

Reply With Quote
  #15  
Old Mon 11 January 2010, 06:36
sailfl
Just call me: Nils #12
 
Winter Park, FL
United States of America
Robert,

M3/M4 turn the router / spindle on.
M9 turn it off
M30 Must also turn it off because most gcode appears to not use M9 but only M30.

Is that what you are asking?
Reply With Quote
  #16  
Old Mon 11 January 2010, 16:33
Greolt
Just call me: Greg
 
Victoria
Australia
Quote:
Originally Posted by sailfl View Post
M3/M4 turn the router / spindle on.
M9 turn it off
M30 Must also turn it off because most gcode appears to not use M9 but only M30.
M5 Stops spindle rotation

M9 stops coolant

M30 Signals program end and rewind

Greg
Reply With Quote
  #17  
Old Mon 11 January 2010, 17:12
sailfl
Just call me: Nils #12
 
Winter Park, FL
United States of America
Greg,

Thanks, I missed the M5.
Reply With Quote
  #18  
Old Mon 11 January 2010, 18:19
Robert M
Just call me: Robert
 
Lac-Brome, Qc
Canada
Send a message via Yahoo to Robert M Send a message via Skype™ to Robert M
Thanks Heath …but NO !...and yes by me

See my reply on my thread !
Reply With Quote
  #19  
Old Wed 13 January 2010, 13:01
ger21
Just call me: Ger
 
Detroit, MI
United States of America
You can also configure mach3 to turn off the spindle (and other things) when it sees an M30. Look in general config, on the left side.
Reply With Quote
Reply

Register Options Profile Last 1 | 3 | 7 Days Search Today's Posts Mark Forums Read

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:32.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.