584,829 active members*
5,175 visitors online*
Register for free
Login
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006
    Posts
    670

    Running a custom Mcode in the background?

    Hi all. so I'm fairly new to macro programming in general, but I find myself in need of some help. I'm trying to emulate the Haas spindle speed variation that they use on their lathes...but on a mill. I have a macro that works to vary the spindle speed and will run indefinitely, but I'm having a hard time figuring out how to make it run in the background while the main program code executes. I'm sure there must be a way to do this in a while loop, but for the life of me, I can't seem to think of a solution that works. Ideally I'd love to apply my program to a custom mcode (I know how to do that) so I can use it on a few different programs and have another mcode that cancels it.

    Any thoughts or tips would be appreciated. Thanks.

  2. #2
    Join Date
    Jun 2015
    Posts
    4131

    Re: Running a custom Mcode in the background?

    hello cs900, generally such oscilations are for linear axis and for rotary axis; the difference is that rotary axis requires much more response time then a linear axis, so, to make the process fast, you may need to use small oscilations and compute the response time

    once you can measure the response time, you may be able to adjust the segmentation of the linear axis, at least theoreticall

    so, if you run at 2000rpm, and change to 1800, what duration is required, and what is the rpm value when cnc confirms rpm change ? ± 15% eg

    if you can't measure such stuff, then is a shot-in-the-dark: it may work when cutting air, but it may succumb when cutting the part; however, in both situations, is hard to tell what is happening, if you don't know the response time ... even so, it can be done, but i preffer working with numbers

    if the variation functions is installed, you don't have to worry about measuring how it works, because it happens automatically inside the controller; but, if the variation functions is not installed, then you need to measure somehow the output of the code, otherwise, even if it will work, it will be hard to 'push the limits', or some unwanted stuff may start to occur at a scale beyond rough measuring, with effects in time

    if i may, why do you wish to put that on the mill ? k
    indly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  3. #3
    Join Date
    Mar 2003
    Posts
    35538

    Re: Running a custom Mcode in the background?

    What control?
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  4. #4
    Join Date
    Aug 2006
    Posts
    670

    Re: Running a custom Mcode in the background?

    Quote Originally Posted by ger21 View Post
    What control?
    it's a fanuc 3ti model A control.


    deadlykitten, We have some very tall parts that like to chatter during our roughing operations. To overcome, the operator quite frequently will manually vary the spindle speed between 90 and 100% to achieve the same effect. I very much dislike relying on the operator to do this, and would love to automate it. At some point i'd love to be able to stick some accelerometer on there to sense vibration and have the control respond accordingly, but first thing is first, just making sure I can actually control the spindle in a reliable manner.

  5. #5
    Join Date
    Jun 2015
    Posts
    4131

    Re: Running a custom Mcode in the background?

    hi

    ... is there a g-code, or a way, to ignore spindle response ? would help is needed to start moving the linear axis while the spindle is accelerating/decelerating; if this is not possible, then i'm afraid that what you wish for, can't be done by g-code
    Code:
        spindle stopped
        move to home position
        G01 Z-100 F G94 G91 S2500 M03 ( linear and rotary axis, both of them, should begin speeding up at same time  )
    ... actual rpm and desired ±% ( s_min & s_max)
    ... if available, duration to accelerate from s_min to s_max; reverse time
    ... do you wish to check if desired rpm range is within a certain gear ? if so, provide gears range if you wish
    ... actual feed of linear axis G94
    ... linear travel
    ... if available, duration for executing the linear travel, but not in direct mode, but in segmentation mode : made of small segments ( 20 50 10 5 2 1 0.5 0.1 0.05 mm etc; segmentation has to be as small as possible, without succumbing the linear axis )
    ... is there a parameter for in-position ? even better if available from code

    if timings will go well, it will work flawless, otherwise linear axis may get succumbed, or one axis will have to wait for the other to confirm speed / position ( linear waiting for rotary and/or viceversa )

    code can be writen even if times are not available, but is not guaranteed that the desired effect will occur from the 1st run, so more trials will be needed
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  6. #6
    Join Date
    Jun 2015
    Posts
    4131

    Re: Running a custom Mcode in the background?

    At some point i'd love to be able to stick some accelerometer on there to sense vibration and have the control respond accordingly
    if you could implement a senzor inside the machine, and make it comunicate with the controller, and also make the controller behave conditionally based on senzor response, then it may work ...





    there is a signal sent from the potentiometer to the controller : what about you mess up with that signal, thus without rotating the spindle override knob ? talk with an electronist, so to place something in there ... activate it by M code :
    ... off : normal behaviour
    ... on : oscilation
    ... reseting the cnc + emergency stop + spindle speed override <>100% + other actions that i am not aware at this moment, should also generate "off" behaviour

    this may work, and i believe that is easier to be implemented then the accelerometer / kindly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

Similar Threads

  1. Yasnac I80 - add Mcode
    By kudos in forum CNC Machining Centers
    Replies: 0
    Last Post: 03-26-2017, 06:01 PM
  2. How to have script running in the background?
    By LordyGordy in forum Mach Software (ArtSoft software)
    Replies: 2
    Last Post: 04-25-2016, 04:46 PM
  3. G code or Mcode for Door opening
    By peaceandcalm in forum G-Code Programing
    Replies: 4
    Last Post: 11-27-2015, 02:18 AM
  4. A small quirk with Mcode setup..
    By murphy625 in forum CamSoft Products
    Replies: 3
    Last Post: 04-03-2005, 04:14 PM
  5. Is there a limit to Mcode files??
    By murphy625 in forum CamSoft Products
    Replies: 1
    Last Post: 04-01-2005, 09:03 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
  •