Lathe Collet User Mcode

More
19 Jul 2019 16:12 - 19 Jul 2019 16:13 #139898 by Erikcnc
Hi all,

After successfully add rpm displaying in Gmoccapy, i am continuing the build of my Emco Lathe machine.
I was away from honeymoon and now i got some time again to work on the lathe.

At the moment i am struggling to get it to work.

In the INI file i got
USER_M_PATH = (*specific map where my M-codes scripts are)

The executable files
--M101--
#!/bin/bash
# opens the collet closer
halcmd setp or2.1.in1 false
sleep 0.5
exit 0

--M102--
#!/bin/bash
# close the collet closer
halcmd setp or2.1.in1 true
sleep 0.5
exit 0

I even tried a m-code scripts like this for both
#!/bin/bash
# close the collet closer
halcmd sets user_m101m102code 0
sleep 0.5
exit 0

In my Hal File
# --- M101 and M102 signal ---

loadrt or2 count=2
addf or2.1 servo-thread

net collet-closer-pedal hm2_7i76e.0.7i76.0.0.input-16 => or2.1.in0
net user_m101m102code => or2.1.in1

net collet-open-close or2.1.out => hm2_7i76e.0.7i76.0.0.output-15

What am i doing wrong here?
Last edit: 19 Jul 2019 16:13 by Erikcnc.

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

More
19 Jul 2019 18:14 #139904 by BigJohnT
Replied by BigJohnT on topic Lathe Collet User Mcode
We need to know what you expected, what you got and any exact error messages.

JT
The following user(s) said Thank You: Erikcnc

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

More
19 Jul 2019 19:13 #139912 by Erikcnc
Replied by Erikcnc on topic Lathe Collet User Mcode

We need to know what you expected, what you got and any exact error messages.

JT


I got no error message when executing the M-codes in MDI. While i am doing that, i watch output pin 15 in halshow.

So far, nothing is happening.

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

More
19 Jul 2019 20:02 - 19 Jul 2019 20:03 #139920 by BigJohnT
Replied by BigJohnT on topic Lathe Collet User Mcode
I just tested your M101 and M102 and they turn off and on or2.1.in1 and or2.1.out turns on and off as expected.

linuxcnc.org/docs/2.7/html/config/ini-co...ml#_rs274ngc_section

USER_M_PATH = myfuncs:/tmp/mcodes:experimentalmcodes - Specifies a list of colon (:) separated directories for user defined functions. Directories are specified relative to the current directory for the ini file or as absolute paths. The list must contain no intervening whitespace.

A search is made for each possible user defined function, typically (M100-M199). The search order is:
1. [DISPLAY]PROGRAM_PREFIX (if specified)
2. If [DISPLAY]PROGRAM_PREFIX is not specified, search the default location: nc_files
3. Then search each directory in the list [RS274NGC]USER_M_PATH

The first executable M1xx found in the search is used for each M1xx.

Do you have a M101 and M102 in the nc_files directory?

JT
Last edit: 19 Jul 2019 20:03 by BigJohnT.
The following user(s) said Thank You: Erikcnc

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

More
19 Jul 2019 20:58 #139924 by Erikcnc
Replied by Erikcnc on topic Lathe Collet User Mcode
In my ini file i got underneath [RS274NGC] the line USER_M_PATH with the direction to => /home/emco/linuxcnc/configs/EMCOTURN220/M-codes/

In the folder M-codes i got the two files that got the name M101 and M102.

Both are selected as executable file.

So why wouldn't hm2_7i76e.0.7i76.0.0.output-15 be triggerd? (in halshow it stays dark red)

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

More
19 Jul 2019 22:07 #139931 by BigJohnT
Replied by BigJohnT on topic Lathe Collet User Mcode
I have to guess that net user_m101m102code => or2.1.in1 is blocking the setp or2.1.in1.

If you run LinuxCNC from a terminal you will see this error

<commandline>:0: pin 'or2.1.in1' is connected to a signal

When in doubt run from a terminal so you can see all the errors.

JT
The following user(s) said Thank You: Erikcnc

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

More
21 Jul 2019 14:13 #140079 by Erikcnc
Replied by Erikcnc on topic Lathe Collet User Mcode
Thanks!!

i am not sure what really cause the problem, but it works perfectly now!
I made the m code scripts again, but changed the True and False to a 1 and 0.
I will share my files soon for those who would like to use it for something similar.

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

Time to create page: 0.136 seconds
Powered by Kunena Forum