Page 1 of 3 123 LastLast
Results 1 to 12 of 33

Thread: EMC2

  1. #1
    Registered
    Join Date
    Nov 2008
    Location
    USA
    Posts
    17
    Downloads
    0
    Uploads
    0

    EMC2

    I am trying to create a M100 to turn an output on in a program. What is the descripter for M100 to be used in HAL. When I create a Gcode program and open it it causes and error because M100 is not defined.

    Jamy


  2. #2
    Registered
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    487
    Downloads
    0
    Uploads
    0
    Did you look in the integrators manual under M100? Did you follow those instructions? We need more info.

    Cheers Chris


  3. #3
    Registered
    Join Date
    Nov 2008
    Location
    USA
    Posts
    17
    Downloads
    0
    Uploads
    0
    This is whats in the manual.

    12.12 M100 to M199 User Defined Commands
    To invoke a user-defined command, program M- P- Q- where P- and Q- are both optional. The
    external program “Mnnn” in the directory [DISPLAY]PROGRAM_PREFIX is executed with the P and Q
    values as its two arguments. Execution of the RS274NGC file pauses until the invoked program
    exits.
    It is an error if
    • The specified User Defined Command does not exist

    I dont what they mean by M- P- Q-. Also the external program "Mnnn" in the directroy [Display]Program_PREFIX is executed with P and Q values as its two arguments. They also talk about the RS274NGC file. I dont know what that is and where to find the file.


  4. #4
    Registered
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    487
    Downloads
    0
    Uploads
    0
    Just to confirm- you want to use M100 to run a 'seperate program' to turn an output on or do you just want a M code to turn a output on?

    For M100 the m- is just the m number you used 100-199, p- and q- are variables that are passed to the seperate program like on the command line. A RS274NGC file is the original G code file. I think the seperate program needs to be named the same as the M number eg. M100 the program is called m100. The program prefix is probably where EMC is supposed to look for the seperate program. I will try to find out.

    If you just want an output turned on and off you want to use M62-65


  • #5
    Registered
    Join Date
    Nov 2005
    Location
    Canada
    Posts
    487
    Downloads
    0
    Uploads
    0
    I asked on the EMC maillist here is what I got:

    >
    > Does this mean the external program must be named M100-199?

    Yes

    > What is meant by PROGRAM_PREFIX ? pathway?

    >From my lathe .ini file:
    ...
    # Sections for display options
    ------------------------------------------------
    [DISPLAY]
    DISPLAY = axis
    LATHE = 1
    PYVCP = spindle.xml

    # DISPLAY = usrmot
    # DISPLAY = tkemc

    CYCLE_TIME = 0.100
    HELP_FILE = doc/help.txt
    POSITION_OFFSET = RELATIVE
    POSITION_FEEDBACK = ACTUAL
    MAX_FEED_OVERRIDE = 1.2
    PROGRAM_PREFIX = ../../nc_files/
    ...

    you can see that the M1xx files will need to be two directories up from
    the current directory and in nc_files. I believe that makes
    it /home/user_name/emc2/nc_files. You can change PROGRAM_PREFIX if you
    want.

    > I assume the external program can be in any supported language or are
    > we talking G code?

    My guess is that you can not execute G-code, but bash, python, C or any
    non-real-time executable would work. I use a bash script to create
    missing g-codes for my lathe, such as M102 Collet Open:

    file = /home/kwallace/emc2/nc_files/M102

    -----------------
    #!/bin/sh

    # Custom - Only intended for Kirk Wallace's HNC lathe, KW 20070823
    # M102 - Opens Collet Closer
    halcmd setp parport.0.pin-07-out False
    halcmd setp parport.0.pin-06-out True

    exit 0
    -----------------

    I use M102 in my G-code files for opening the collet closer.

    hope that helps


  • #6
    Registered
    Join Date
    Feb 2007
    Location
    USA
    Posts
    514
    Downloads
    0
    Uploads
    0
    Jamy,

    In response to your question that chester88 posted on the users list and to Kirk's answer I have updated the manual. See if it makes more sense...

    http://www.linuxcnc.org/docview/html...:M100-to-M199:

    Thanks for asking the question.

    John


  • #7
    Registered
    Join Date
    Nov 2008
    Location
    USA
    Posts
    17
    Downloads
    0
    Uploads
    0
    How do I go about doing the M64 and M65 turning on the Digital output. I know in the program I just type M64. But in the HAL file?


  • #8
    Registered
    Join Date
    Feb 2007
    Location
    USA
    Posts
    514
    Downloads
    0
    Uploads
    0


  • #9
    Registered
    Join Date
    Nov 2008
    Location
    USA
    Posts
    17
    Downloads
    0
    Uploads
    0

    1 input to start program and continue program after a M0

    How do I create an input to start a program in EMC2. Also the same input to run the program after a M0 stop command. I was able to do start the program and when it got to M0 it stopped but when I pressed the input it started the program from the beginning. It seems like I need to do some sort of IF statement. If program.run and mode.auto is true then input only is used to program.run. Is there anyone that can help me?


  • #10
    Registered acondit's Avatar
    Join Date
    Apr 2005
    Location
    USA
    Posts
    1,778
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Jamy View Post
    How do I create an input to start a program in EMC2. Also the same input to run the program after a M0 stop command. I was able to do start the program and when it got to M0 it stopped but when I pressed the input it started the program from the beginning. It seems like I need to do some sort of IF statement. If program.run and mode.auto is true then input only is used to program.run. Is there anyone that can help me?
    If you are just talking about resuming after an M0, I believe that you just press the 'S' key on the keyboard. This is like when the machine stops for a tool change, you have changed the tool and want to resume the run.

    Alan


  • #11
    Registered
    Join Date
    Nov 2008
    Location
    USA
    Posts
    17
    Downloads
    0
    Uploads
    0
    Yes I know the S will work and also clicking on the resume button on the screen. What I am refering to is a button used by a operator to start a program. I would like to use the same button to resume the program when the program is paused (M0). The only input the operator can toggle is this button. The button is setup like this remote-start halui.program.run halui.mode.auto = parport 15

    What Im going to try next is to create a manual and auto button on the screen. By selecting auto the switch can be configured as remote start halui.program. run halui.program.resume=parport 15. I have a feeling that it probaly will just start the program over with having Halui.program.run.

    Any other suggestions?


  • #12
    Registered
    Join Date
    Feb 2007
    Location
    USA
    Posts
    514
    Downloads
    0
    Uploads
    0
    If you use halui you can take advantage of the pins halui.program.is-paused, is-idle, resume, run to restart/start based on the current status. For this you use a logic operator to do the right thing.

    In your hal file you want to do the following pseudo code

    Code:
                                If paused then resume
    My button pressed |
                                If idle then start
    John


  • Page 1 of 3 123 LastLast

    Similar Threads

    1. Need Help!- M8 still not being red by EMC2
      By SpeedsCustom in forum LinuxCNC (formerly EMC2)
      Replies: 27
      Last Post: 04-13-2008, 04:36 PM
    2. EMC2 to diy CNC
      By dakiller322 in forum LinuxCNC (formerly EMC2)
      Replies: 11
      Last Post: 10-05-2007, 01:16 AM
    3. Emc2
      By sdantonio in forum Mach Mill
      Replies: 2
      Last Post: 02-05-2007, 03:26 PM
    4. emc2 -hal*?
      By essa in forum LinuxCNC (formerly EMC2)
      Replies: 3
      Last Post: 05-27-2006, 01:06 PM
    5. emc2
      By heilcnc in forum LinuxCNC (formerly EMC2)
      Replies: 2
      Last Post: 05-23-2006, 06:03 PM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.