M codes

More
21 Jun 2011 08:32 #10691 by ArcEye
Replied by ArcEye on topic Re:M codes

i have the file m101 in my PROGRAM_PREFIX directory and it's executable.
i'm trying to call it in my program with m101 p4. i'm getting "unknown m code used"
T'anks !

my m101 file;
#!/bin/sh

feedrate=$2

halcmd setp thc.feedrate $feedrate

exit 0


It is possible your M101 file IS working

Why are you passing only 1 parameter to your M101 and then using parameter 2 to set your feedrate?

Feed rate would always be set to -1.000000 which is the default value emc passes in the absence of any user input.

Run emc from within a terminal, so that you can see output in the terminal. Put the attached file in your PROGRAM_PREFIX directory and run 'M111 Pnn in the MDI window

You should get an output of 'Parameter entered was nn' where nn is whatever number you used.

regards

File Attachment:

File Name: M111-b2a66...54d4.zip
File Size:0 KB
Attachments:

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

More
21 Jun 2011 09:55 #10696 by piasdom
Replied by piasdom on topic Re:M codes
Thanks. i did that and got unknown m code.
but i'm guessing it's because i don't have
thc loaded as john figured out.

i was trying to adjust the feed while the machine was running
with a pyvcp button. john says it will(should) be in 2.5.

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

More
21 Jun 2011 16:08 #10709 by ArcEye
Replied by ArcEye on topic Re:M codes

Thanks. i did that and got unknown m code.
but i'm guessing it's because i don't have
thc loaded as john figured out.


All the file I attached does is convert the parameter passed by emc to an integer and echo it back.

It is not dependent upon anything else, if you can't run it, you will not be able to run any M1xx routines until you find the problem.

I don't know why so many people have trouble getting this to work, I am trying to assist someone else re very similar.

Assuming as you say, you have put it in the right directory and set it as executable,
all I can suggest is that you log in as root, try launching emc then call M111 Pnn from the MDI window.

If that works, it is all about your user permissions.

If it doesn't work, try chmod 'ing the file to 755 as root, close emc , launch again and try again.
(this is important because emc caches stuff and if you modify a M1xx file it won't see the change until next session)

If that works, it is also about your user access and not being able to set the file permissions you thought you were doing.

regards

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

More
21 Jun 2011 16:41 - 21 Jun 2011 16:42 #10715 by piasdom
Replied by piasdom on topic Re:M codes
cool,i had changed the permission before did but had to
do that again. then ran sudo emc to start and got correct output.
Thanks.
Last edit: 21 Jun 2011 16:42 by piasdom.

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

More
22 Jun 2011 11:03 #10757 by ArcEye
Replied by ArcEye on topic Re:M codes
Glad you got it sorted, Linux is pretty secure but sometimes that causes problems of itself.

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

Time to create page: 0.159 seconds
Powered by Kunena Forum