Hello Guest it is March 28, 2024, 06:51:03 AM

Author Topic: associating M codes to output points  (Read 2729 times)

0 Members and 1 Guest are viewing this topic.

associating M codes to output points
« on: March 01, 2017, 03:14:00 PM »
trying to find a table that will allow me to associate an existing m code number to a output number so that when I write the machining file I can enter say m12 to turn on out put 2 and m13 to turn it off type of thing.    ???

I am still pretty new with the m and g codes so lets start simple and then go to complex
butch

Offline Myk3

*
  •  15 15
    • View Profile
Re: associating M codes to output points
« Reply #1 on: March 01, 2017, 08:36:04 PM »
I am very new to this, but I don't think that is possible..

Each M code already does something.. you can do things inside mach3 which kicks other things off on output pins.. for instance my M3 / M4 commands sends the output one to turn on.. this M3 / M4 command is part of the normal gcode and it is designed to turn the spindle CW or CCW.. I use it to turn on a relay which turns on the router..

Anyway...

Here is a list of the G and M codes..

http://www.cnccookbook.com/CCCNCGCodeRef.html

there are more than that listed there as well.. For instance.. The same M3 / M4 codes have a slight delay.. so I use a M11p1 and M10p1 to turn on / off my laser. These mcodes aren't documented for the most part but they also don't have the normal delay associated with the M3 / M4 commands..
Re: associating M codes to output points
« Reply #2 on: March 01, 2017, 08:51:23 PM »
talk to me about the m10 and m11 codes and how many of them are there and how did you get them assigned to the outputs ???????????????????

butch

Offline Myk3

*
  •  15 15
    • View Profile
Re: associating M codes to output points
« Reply #3 on: March 01, 2017, 08:56:30 PM »
I didn't have to associate them to the output.. They are programmed into mach 3 as being alternate commands for spindle on / off.. You would tell MACH3 the output for your spindle and the M3 / M4 commands will turn on the output you have associated with your spindle (under outputs) and (Spindle setup) and M5 will turn it off.. M11p (pin #) turns the router on and M10p(pin#) will turn it off..
Re: associating M codes to output points
« Reply #4 on: March 01, 2017, 09:20:06 PM »
ok the m11p is pin numbers associated with the m3/4 commands makes since now.  I was thinking it was something different

butch
Re: associating M codes to output points
« Reply #6 on: March 01, 2017, 09:36:10 PM »
did some more web searching and found this info
now just to figure out how to associate it to the ouput pins
specificly m10 and m11 as I have a lathe with a turret head on it with a servo drive and encoders.
the lock and unlock is an air solenoid so I just need to turn that solenoid on and off ( reason for m code ) I can then associate the servo with the y or a axises in the g code  and use the g01 command to rotate it to the desired position.  as I can set the counts to a numeric value matching the station number and use the G01 command. ie
station 1 or zero depending on how you look at it is home
station 2 would be say 2 and that would equal 1000 counts from the encoder to reach that position
station 3 would be say 3 and that would equal 2000 counts from the encoder to reach that position   and so on you get the picture hear

where we usually associate the counts to a inch increment we now associate it with a station number or you can make it equal to degrees if you like but in short all the same.

CNC M Codes

M00 - Program stop; Mill and Lathe
 M01 - Optional program stop; Lathe and Mill
 M02 - Program end; Lathe and Mill
 M03 - Spindle on clockwise; Lathe and Mill
 M04 - Spindle on counterclockwise; Lathe and Mill
 M05 - Spindle off; Lathe and Mill
 M06 - Toolchange; Mill
 M08 - Coolant on; Lathe and Mill
 M09 - Coolant off; Lathe and Mi
 M10 - Chuck or rotary table clamp; Lathe and Mill
 M11 - Chuck or rotary table clamp off; Lathe and Mill[/color]
 M19 - Orient spindle; Lathe and Mill
 M30 - Program end, return to start; Lathe and Mill
 M97 - Local sub-routine call; Lathe and Mill
 M98 - Sub-program call; Lathe and Mill
 M99 - End of sub program; Lathe and Mill
Re: associating M codes to output points
« Reply #7 on: March 01, 2017, 09:58:20 PM »
ok just got your post on the another discussion of this and this is making much more since now
the m10/m11 are a manual turn on and off of a output pin  so the command consists of m10( pin number ) and the g0 code to get it to implament the command

thank you for the help  :)
butch