585,875 active members*
4,084 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > Applying tool length compensation from C program
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2012
    Posts
    537

    Applying tool length compensation from C program

    Hi Tom,

    I made a variation of my tool change program to just increment to the next tool at the push of a button. Saves a few seconds when loading and unloading a bunch of tools.

    But its not applying tool length compensation when finished like when using the drop down menu or an M06 command. Is there a way to do this easily? Thanks

    Mark

  2. #2
    Join Date
    May 2006
    Posts
    4045

    Re: Applying tool length compensation from C program

    Hi Mark,

    I'm not sure I understand, but to turn on tool length compensation for a tool you might issue an MDI command of HxG43
    TK
    http://dynomotion.com

  3. #3
    Join Date
    May 2012
    Posts
    537

    Re: Applying tool length compensation from C program

    Quote Originally Posted by TomKerekes View Post
    Hi Mark,

    I'm not sure I understand, but to turn on tool length compensation for a tool you might issue an MDI command of HxG43
    Well just trying to save some setup time when loading and unloading tools. Instead of moving mouse to drop down box and selecting proper tool each time, I just created a slightly different tool change program to change to the "Next Tool" (in carousel) by pushing a user button. Using a keyboard shortcut so I dont have to touch mouse at all, only one button to advance one tool. Just to make it a little faster when loading and unloading 10-15+ tools.

    If I used the drop down box, or an M06 command the tool length compensation is applied automatically. If I use my new program, it is not. I ended up setting my part origin yesterday with the wrong offset because of this, which could possibly cause a crash if I'm a little careless sometime.

    Any way I can get around needing to put in the "X" in HxG43? I could setup my new program as an M code, then setup a user button to execute that M code, and also a G43, but id need someway of getting it to apply the proper offset for the current tool. My current tool number is always stored in a persistent variable by my toolchange program if thats any help.

  4. #4
    Join Date
    May 2006
    Posts
    4045

    Re: Applying tool length compensation from C program

    Hi Mark,

    Couldn't you have your modified Tool Change C Program command an MDI with the HxG43? It has the tool number doesn't it?
    TK
    http://dynomotion.com

  5. #5
    Join Date
    May 2012
    Posts
    537

    Re: Applying tool length compensation from C program

    Hi Tom,

    Yes it knows the current tool number. Current tool = persist.UserData[157]. How do I send a MDI command with that value for "X"?

    Mark

  6. #6
    Join Date
    May 2006
    Posts
    4045

    Re: Applying tool length compensation from C program

    Hi Mark,

    Similar to the SetToolNumber.c example. Use sprintf to format a string.


    Code:
    #include "KMotionDef.h"
    
    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
    
    #define LAST_TOOL_VAR 8     //  -1=Spindle empty, 0=unknown, 1-4 Tool Slot loaded into Spindle
    
    main()
    {
        char s[80];
        sprintf(s,"T%d",persist.UserData[LAST_TOOL_VAR]);
        MDI(s);  //send the T word
    }
    TK
    http://dynomotion.com

  7. #7
    Join Date
    May 2012
    Posts
    537

    Re: Applying tool length compensation from C program

    Hi Tom,

    This seems to be working perfectly. Thanks! In case it helps anybody the code im using is:

    char s[80];
    sprintf(s,"G43H%d",persist.UserData[157]);
    MDI(s); //send

Similar Threads

  1. Replies: 6
    Last Post: 09-02-2014, 09:16 PM
  2. Replies: 7
    Last Post: 01-23-2013, 05:46 PM
  3. tool length compensation H registers help
    By muxster in forum Dynapath
    Replies: 12
    Last Post: 08-05-2010, 05:23 PM
  4. 90deg Head Tool Length Compensation
    By christinandavid in forum Fanuc
    Replies: 2
    Last Post: 03-20-2010, 09:25 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •