Applying tool length compensation from C program


Results 1 to 7 of 7

Thread: Applying tool length compensation from C program

  1. #1
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    388
    Downloads
    0
    Uploads
    0

    Default 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

    Similar Threads:


  2. #2
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3074
    Downloads
    0
    Uploads
    0

    Default 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

    Regards
    TK http://dynomotion.com


  3. #3
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    388
    Downloads
    0
    Uploads
    0

    Default 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
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3074
    Downloads
    0
    Uploads
    0

    Default 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?

    Regards
    TK http://dynomotion.com


  5. #5
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    388
    Downloads
    0
    Uploads
    0

    Default 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
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3074
    Downloads
    0
    Uploads
    0

    Default 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
    }


    Regards
    TK http://dynomotion.com


  7. #7
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    388
    Downloads
    0
    Uploads
    0

    Default 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



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
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Applying tool length compensation from C program

Applying tool length compensation from C program