586,052 active members*
4,263 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Dynomotion/Kflop/Kanalog > Execute MDI from C program? Cant seem to figure this out
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2012
    Posts
    537

    Execute MDI from C program? Cant seem to figure this out

    Hi guys im trying to execute a MDI line from a C program but im not getting any result. I got an error first but then included kfloptokmotioncncfunctions and the code ran, but didnt do anything. I read a little here: Controlling KMotionCNC from KFLOP I tried a move similer to the MDI("G0 X1.2 Y2.2 Z3.3"); in this example program but nothing. Can somebody give me more detailed instructions?

    Im trying to add an automatic G43 H(tool number) to my toolchanger c program so i dont have to worry about offset numbers. If there is a better way to do this im open to suggestions. Thanks.

  2. #2
    Join Date
    May 2006
    Posts
    4045

    Re: Execute MDI from C program? Cant seem to figure this out

    Hi mmurray70,

    I think the issue has to do with the GCode Interpreter not being re-entrant. Which means in order to use the MDI function in KFLOP the Interpreter must be idle. So the MDI can't be called while the Interpreter is executing an MCode. It can be used from a User Button for example. So I don't think that will work for your situation.

    Could you provide more info on the problem you are trying to solve?

    Regards
    TK
    http://dynomotion.com

  3. #3
    Join Date
    May 2012
    Posts
    537

    Re: Execute MDI from C program? Cant seem to figure this out

    Hi Tom,

    Thanks for the reply. Makes sense. Is this the same case when trying to execute an M code from within another M code c program? This was another headache i had last week. Was trying to execute a M5 spindle stop at the start of my toolchange program as a safety check, but couldnt not get that to work either. I just copied the code in after. That was a fairly easy fix.

    The problem im trying to solve now is... I have the toolchanger working now on my Fadal Mill, and if possible i would like for Kmotioncnc to apply the tool length compensation automatically when i do a toolchange from g code so i dont have to bother with offset numbers. The mazak ive been running at work does not need offset numbers for tool length and i find it very convenient. One less thing to try and remember when programming.

    I thought i could do the MDI thing at the end of my toolchange C program but i guess not. When i change tools in the tool table the tool length is applied automatically, but if use mdi to do a tool change the length compensation is not applied. I know of couse that i can use G43 H2 for example, but just trying to avoid that step if i can. Thanks.

    Mark

  4. #4
    Join Date
    May 2006
    Posts
    4045

    Re: Execute MDI from C program? Cant seem to figure this out

    Hi Mark,

    Is this the same case when trying to execute an M code from within another M code c program? This was another headache i had last week. Was trying to execute a M5 spindle stop at the start of my toolchange program as a safety check, but couldnt not get that to work either. I just copied the code in after. That was a fairly easy fix.
    Actually you should be able to invoke an M Code from KFLOP as it doesn't require the Interpreter (it uses the GUI thread to just perform the Action Directly). I'm not sure why it didn't work. If you were executing both M Codes in the same thread that could be the problem. But copying the code is probably a good approach.

    I thought i could do the MDI thing at the end of my toolchange C program but i guess not. When i change tools in the tool table the tool length is applied automatically, but if use mdi to do a tool change the length compensation is not applied. I know of couse that i can use G43 H2 for example, but just trying to avoid that step if i can.
    I can't think of a way to do that without adding some new functionality. Normally it is expected that the GCode determines explicitly if the length compensation is to be turned on or off regardless of what tool is loaded.

    Regards
    TK
    http://dynomotion.com

  5. #5
    Join Date
    May 2012
    Posts
    537

    Re: Execute MDI from C program? Cant seem to figure this out

    Ok no worries, thanks anyway for trying to help.

Similar Threads

  1. How do I load and execute a program off of floppy
    By bill guinn in forum Milltronics
    Replies: 2
    Last Post: 11-18-2020, 05:35 AM
  2. G01 no movement during execute the program
    By mzar in forum Fagor Automation
    Replies: 9
    Last Post: 11-01-2019, 07:10 PM
  3. Replies: 1
    Last Post: 02-29-2008, 02:32 AM
  4. How to execute a cnc program without logging to the execute mode of the graphical use
    By sabreen in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 0
    Last Post: 02-04-2008, 12:29 PM
  5. How do you make Bridgeport execute program?
    By Bill Gillen in forum Bridgeport / Hardinge Mills
    Replies: 10
    Last Post: 06-14-2005, 02:26 PM

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
  •