Hi guys: I am trying to help someone on cnc zone to use M100 but I don'tunderstand the manual desription nor can I find anything in the wiki to help.the manual says:
To invoke a user-defined command, program M- P- Q- where P- and Q- are both optional.
The external program “Mnnn” in the directory [DISPLAY]PROGRAM_PREFIX is executed withthe P and Q values as its two arguments.
Execution of the RS274NGC file pauses until the invoked program exits.
Does this mean the external program must be named M100-199?
What is meant by PROGRAM_PREFIX ? pathway?
I assume the external program can be in any supported language or are we talking G code?
Yes > What is meant by PROGRAM_PREFIX ? pathway?
>From my lathe .ini file:
- Sections for display options
[DISPLAY]DISPLAY = axis
LATHE = 1
PYVCP = spindle.xml
- DISPLAY = usrmot
- DISPLAY = tkemc
CYCLE_TIME = 0.100
HELP_FILE = doc/help.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
PROGRAM_PREFIX = ../../nc_files/
... you can see that the M1xx files will need to be two directories up from
the current directory and in nc_files. I believe that makes
it /home/user_name/emc2/nc_files. You can change PROGRAM_PREFIX if you want.
> I assume the external program can be in any supported language or are
we talking G code?
My guess is that you can not execute G-code, but bash, python, C or any
non-real-time executable would work. I use a bash script to create
missing g-codes for my lathe, such as M102 Collet Open: file = /home/kwallace/emc2/nc_files/M102
- Custom - Only intended for Kirk Wallace's HNC lathe, KW 20070823
- M102 - Opens Collet Closer
halcmd setp parport.0.pin-07-out False
halcmd setp parport.0.pin-06-out True
I use M102 in my G-code files for opening the collet closer.