M100 to M199 User Defined Commands

More
26 May 2013 11:43 #34708 by garymcrobertpdx
Having trouble getting LinuxCNC to find my M100 bash file.
Keep getting "unknown m code used" error message
Probably a path issue, do I add some sort of path info to ini file?

Please Log in or Create an account to join the conversation.

More
26 May 2013 18:54 #34713 by ArcEye
Hi

The file must be in the directory pointed to by PROGRAM_PREFIX= in the ini file
The path should be a full path not ~/xxx since only bash can expand the tilde, linuxcnc can not presently.

It must also be executable and remember that linux is case sensitive,
I always name my files with a capital M since that is how I write GCode, with all commands and axes in uppercase

regards

Please Log in or Create an account to join the conversation.

More
26 May 2013 23:07 #34719 by garymcrobertpdx
Still not having success. The ini path statement looks good

PROGRAM_PREFIX = /home/me/linuxcnc/nc_files

The M100 file was a copy from the example M101 file

So I have recopied the example M101 file added my halcmd and saved it as
M100. Linuxcnc no longer gives me the unknown M code error.

But according to Hal Meter hm2_5i25.0.7i76.0.0.output-14 fails to become true.
The M100 file looks like this.

#!/bin/sh

# M100 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 "M100 P$P Q$Q: put your code here"
halcmd setp hm2_5i25.0.7i76.0.0.output-14 <= TRUE
exit 0

Is there some Linux Voodoo that has to be done to permit a BASH file to run?

Please Log in or Create an account to join the conversation.

More
26 May 2013 23:45 - 26 May 2013 23:45 #34721 by PCW
You can always try running the script by hand in a terminal:

cd /home/me/linuxcnc/nc_files
./M100

My guess is that the "<=" is not legal setp syntax or the M100 file is not executable
Last edit: 26 May 2013 23:45 by PCW. Reason: sp

Please Log in or Create an account to join the conversation.

More
26 May 2013 23:54 - 26 May 2013 23:57 #34722 by ArcEye

halcmd setp hm2_5i25.0.7i76.0.0.output-14 <= TRUE


setp only takes 2 arguments, first is the param or pin name and second is the value to set it to

The only place you can use => or <= is in net commands, which specifically ignore them

You also may not be able to access the pin anyway, open the Hal Configuration window and try out the command in the command box first
Last edit: 26 May 2013 23:57 by ArcEye.

Please Log in or Create an account to join the conversation.

More
27 May 2013 09:02 #34742 by garymcrobertpdx
Yes you are correct The => or <= fouls things up however there is no error message generated.

By trial and error have found that in a bash file an expression like halcmd setp or2.0.in1 TRUE
works. But when or2.0 is loaded or2.0.in1 must not be linked to any thing in the Hal.

Thanks for the help guys

Please Log in or Create an account to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum