Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: 2000mph on June 22, 2010, 11:54:04 PM
-
Hi everyone,
I am building a machine to automate an assembly process. I involves actuating solenoid valves and relays (along with controlling stepper motors). I want to use M codes to do this.
I have Mach3 installed and working (the motors work fine). I made a custom BreakOut Board that has the required driver circutry for the solenoids and relays. It also works properly.
For testing purposes, I am using M3, M4, M7, and M8 as they are easy to configure. I need more than four M codes and M3/M4 cannot be "On" at the same time.
How do I go about creating my own M codes?
Thanks!
-
I found a post in another forum that showed how to use VB Scripting to do it.
To activate an output, I wrote the following script:
ActivateSignal(OUTPUT1)
Then I saved it as m111.m1s (I chose the M code as M1xx as my custom code and Mx1x to signify output 1 and Mxx1 to signify the output active.
To deactivate an output, I wrote the following script:
DeactivateSignal(OUTPUT1)
Then I saved it as m110.m1s (I chose the M code as M1xx as my custom code and Mx1x to signify output 1 and Mxx0 to signify the output inactive.
I then did the for all the outputs I need, of course I changed the M code and outputs to correlate with each other.
I can then test it by using the MDI screen and entering the appropriate M code and hit enter.
It works like a charm!
-
Brilliant my friend - Everything is here on the forum and you took the trouble to look for the solution. :)
If only I could solve the E1P1 /E1P0 problem that way :'(
Tweakie.
-
Many thanks 2000MPH, very helpful post.
I would also add chapter 10.9 in the manual states that new macros can be written using and external editor like notepad.
-
If anyone needs a little more help with this see http://www.machsupport.com/forum/index.php/topic,15425.0.html