diff options
author | Fred Proctor <proctor@users.sourceforge.net> | 2005-04-27 20:14:33 +0000 |
---|---|---|
committer | Fred Proctor <proctor@users.sourceforge.net> | 2005-04-27 20:14:33 +0000 |
commit | fac06814c549b192fb16fbaa6453b636aefef5e0 (patch) | |
tree | 95ccb8220fc369f5067a78bdefa80b18bb397f11 | |
parent | 3389e045960b638858298d77901d4e3b85730aa4 (diff) | |
download | linuxcnc-fac06814c549b192fb16fbaa6453b636aefef5e0.tar.gz linuxcnc-fac06814c549b192fb16fbaa6453b636aefef5e0.zip |
Added M101, M102.c as example custom M code files that print their P and Q
values.
-rwxr-xr-x | nc_files/M101 | 13 | ||||
-rw-r--r-- | nc_files/M102.c | 29 |
2 files changed, 42 insertions, 0 deletions
diff --git a/nc_files/M101 b/nc_files/M101 new file mode 100755 index 000000000..9e77aedae --- /dev/null +++ b/nc_files/M101 @@ -0,0 +1,13 @@ +#!/bin/sh + +# M101 in your G code program will run the Linux commands in this +# shell script "batch" file, passing the P and Q variables as command +# line arguments. + +# give the command line arguments descriptive names +P=$1 +Q=$2 + +echo "M101 P$P Q$Q: put your code here" + +exit 0 diff --git a/nc_files/M102.c b/nc_files/M102.c new file mode 100644 index 000000000..7b3895777 --- /dev/null +++ b/nc_files/M102.c @@ -0,0 +1,29 @@ +#include <stdio.h> + +/* + Compile this with "gcc M102.c -o M102" to build an M102 executable + program in the emc/programs/ directory. M102 in your G code program + will execute this code, passing the P and Q variables as command + line arguments. + */ + +int main(int argc, char *argv[]) +{ + double p = 0.0, q = 0.0; + + /* process the P and Q command line args we will be given */ + if (argc > 1) { + sscanf(argv[1], "%lf", &p); + } + if (argc > 2) { + sscanf(argv[2], "%lf", &q); + } + + /* put your code here */ + + printf("M102 P%f Q%f: put your code here\n", p, q); + + return 0; +} + + |