Custom M Codes Not Working

More
05 Feb 2013 17:40 - 05 Feb 2013 17:49 #29628 by Willheg
Hello People,

I have been playing round for the last couple of days with custom M Codes but am not seeing happen what I think should happen.

I am running a PCI Parport to if that makes the difference

I made 4 files, 2 to turn on a parport pin each, and 2 to turn them off.

I load LinuxCNC and home everything then try in MDI mode to run the M Code and it doesn't turn on the relay/motor it is ment to yet it doesn't give any message about not being a valid M Code.

Any help on this would be great, i have read most of the articals i can find on google about this but tried everything i read and nothing seems to work.

This is one of the files i wrote and it looks to be right to me???

#!/bin/bash
#File to turn on parport pin 14 to start Dust Collector
halcmd set parport.0.pin-14-out True
exit 0

and placed that in the directory where it defaults to in the .ini file, but if i link the pins to spindel cw and run m3 it works them to turn them on and m5 turns them off, so i'm confussed.

Also created one to load an image and unless i took out the "#!/bin/bash" it would do anything but if i removed "#!/bin/bash" it loaded the image editor but not the image saying something about the direcotry yet it had 3 backslashs (i.e. ///home/???/???/???/test.png) infront of it so help here would be great as well if possible thanks.

here is whats in the file:

#!/bin/bash
#File
eog /home/william/linuxcnc/configs/willscnc/Test.png
exit 0


Thanks

William
Last edit: 05 Feb 2013 17:49 by Willheg. Reason: Forgot to put information in about PCI parport

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

More
05 Feb 2013 18:57 #29633 by alan_3301
are you running a livecd installation?

try running
eog /home/william/linuxcnc/configs/willscnc/Test.png
from the command line to make sure that works.

Also if you click a desktop icon to load linuxcnc, instaed run it from the command line so you can see any error messages that pop up.

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

More
05 Feb 2013 21:09 #29645 by BigJohnT
Replied by BigJohnT on topic Custom M Codes Not Working
I had to use a slightly different syntax.
#!/bin/sh
# open the collet closer
eval halcmd setp or2.3.in1 1
sleep 0.25
eval halcmd setp or2.3.in1 0
sleep 0.5
exit 0

And I just noticed you have "set" and not "setp" as it should be.

John

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

More
06 Feb 2013 04:38 #29669 by Willheg
Replied by Willheg on topic Custom M Codes Not Working
Thanks for the help, i will try these bit's of information today and see how i go,

i'm a bit confussed on your one john, is there some more information on the way to program how you had to??

William

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

More
06 Feb 2013 05:04 #29672 by Willheg
Replied by Willheg on topic Custom M Codes Not Working
oh and allan_3301

i'm am not running a livecd intall, i have installed LinuxCNC 2.5.0 to the hard drive

William

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

More
06 Feb 2013 07:59 #29675 by BigJohnT
Replied by BigJohnT on topic Custom M Codes Not Working

Thanks for the help, i will try these bit's of information today and see how i go,

i'm a bit confussed on your one john, is there some more information on the way to program how you had to??

William


I'm not sure but the eval is a bash command I think. In any case you need to change set to setp so the hal command will work.

John

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

More
06 Feb 2013 23:04 #29709 by ArcEye
Replied by ArcEye on topic Custom M Codes Not Working
eval is not used very much and not needed in this case

It comes into its own when making up an argument string to a commandline, from items which are references, some of which are escaped (to show the actual character is required not the operator).
It evaluates the command and pre processes it.

eg eval echo \${$x} will evaluate to echo $6, where the value of x = 6
echo would not resolve that itself

The easiest way to test is to either run run from a commandline whilst linuxcnc is running and watch the pin changes in the Hal Configuration window ( or type the command in the Test HAL command window)

If it works there, it is only a matter of paths and permissions to run it from a M Code file

regards

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

More
07 Feb 2013 17:54 #29756 by Willheg
Replied by Willheg on topic Custom M Codes Not Working
Hello again people,

Thanks for the help, I made a few changes to my permissions and a few other bits and got one of my cudtom M code files to work out of 4 which is ok, cause i just copied it 3 more times and changed what i needed to and got them to work somehow.

But thanks for everyones help.

William.

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

Time to create page: 0.157 seconds
Powered by Kunena Forum