603,930 active members*
4,154 visitors online*
Register for free
Login
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2004
    Posts
    241

    Spindle Speed Override: How to Implement?

    Greetings,

    With my custom C# software, for running the KFlop Controller, I am interested in doing Spindle Speed Override. I have on my screen all the buttons, and everything programmed in my software to handle this. All this gets loaded into a Global Variable, GV.RPM.

    I know in KMotion, that there is a spindle speed setting... that is set when you issue a GCode S1000, which would set the spindle speed to 1000 RPM.

    What command would I send to the Kflop, to do spindle override? Does anyone know?

    I found .KM_Interpreter_SetupParams.AllowSpindleSpeedOverride
    And also: KM_Interpreter_SetupParams.SpindleSpeed
    __________________________________________________ __
    Can these be used to override the current speed setting of the spindle, and are they percentages, or RPM's?

    Thanks so much,
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  2. #2
    Join Date
    Feb 2006
    Posts
    7063

    Re: Spindle Speed Override: How to Implement?

    Just use another global variable to send the SSO, and have a thread running on the KFlop that periodically checks both the S-word and SSO, and updates the PWM (or whatever) controlling the spindle speed. I have a large block of globals that can be passed from the PC so I can change almost anything on the fly, even axis tuning parameters. This lets me keep all configuration information in an XML file on the PC, rather than having stuff hard-coded into my (many) KFlop programs.

    Regards,
    Ray L.

  3. #3
    Join Date
    May 2006
    Posts
    4091

    Re: Spindle Speed Override: How to Implement?

    Hi jeffserv

    I see KMotionCNC handles it like this in C++:

    Interpreter->CoordMotionm_SpindleRateValue);
    Interpreter->InvokeAction(10,FALSE); // resend new Speed

    But we currently don't export the CoordMotion->SetSpindleRateOverride() function to .NET.

    So you would need to use the approach Ray describes of writing a multiplier to KFLOP and applying the multiplier within KFLOP like he did.

    If you would like us to export this function in a Test Version we can do this.

    Regards
    TK
    http://dynomotion.com

  4. #4
    Join Date
    Jul 2004
    Posts
    241

    Re: Spindle Speed Override: How to Implement?

    Tom,
    I would prefer to have direct access, just like I do with the FeedRateOverride... to have access to the SpindleRateOverride, directly from C# would be ideal.
    How long would it take for you to provide the Test version?

    Ray,
    Could you explain, how I can create and access Global Variables, on the Kflop, and how C# and C programs access the same variables. I have not done this before?
    The S command when incountered runs a C program that sets the PWM.
    But I don't have a clue, how that info. gets into a variable on the Kflop? Or how to create one that I have access to on the Kflop, that is not there already??

    Thanks,
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  5. #5
    Join Date
    Feb 2006
    Posts
    7063

    Re: Spindle Speed Override: How to Implement?

    I don't recall the details of exactly what I did (it was several years ago), but it's basicallyvery simple. There are DLL calls that allow you to read and write KFlop Persist Vars from the PC app. Simply define a specific location within the Persist Var space to hold the current SSO value. When SSO is changed in the GUI, update that Persist Var. On the KFlop, have one of your threads periodically check that Persist Var, and update the PWM output (or whatever your spindle speed control is) accordingly. There are quite a few controls that are easily implemented in this way, so I simply setup a large block, perhaps a few hundred words, to hold all of them, and I can now update almost anything on the KFlop at any time by just modifying those Vars, making almost everything dynamically changeable from the PC app without having to do a restart of the KFlop or the PC app. The only headache is making sure the KFlop code and the PC code both have the same definitions of where things are in the Persist Var space, but that's a minor issue.

    Regards,
    Ray L.

  6. #6
    Join Date
    Jul 2004
    Posts
    241

    Re: Spindle Speed Override: How to Implement?

    Thanks Tom and Ray,

    I have accepted the idea... of using the "User Variables".

    I did a search in C# and found Get and Set functions in KMotions DLL that will allow me to work with them.
    KM in my C# program = KM_Controller.

    KM.GetUserDataFloat(1); This reads the info. from the KFlop controller.
    KM.SetUserDataFloat(1,1000); This sets the data location, and value.

    I tested and already have my "Global Variable" updating one of these user variables.

    Today I will see if I can modify my C program to use this second override setting. Thus a spindle override, setting.
    When I press a override button, I will need to send a command to run the PWM C program, to update that setting. I think there are several ways to tell a C program to run. I will investigate that and see if I can get that operational.

    Thanks for all your help!:rainfro:
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

  7. #7
    Join Date
    May 2006
    Posts
    4091

    Re: Spindle Speed Override: How to Implement?

    Hi jeffserv,

    Sorry for the delay providing the access to SpindleRateOverride variable. We should have a Test Release out soon.

    But your method should produce the same result.

    To re-invoke the Spindle Program after changing your override you should be able to call InvokeAction in the Interpreter Class with an index of 10 and "false" to not flush any prior motion.

    public int InvokeAction(int i, bool flushbeforeunbufferedoperation)

    Regards
    TK
    TK
    http://dynomotion.com

  8. #8
    Join Date
    Jul 2004
    Posts
    241

    Re: Spindle Speed Override: How to Implement?

    Tom,

    OK, I have this working to my satisfaction, and have Spindle Speed override.

    I was unable to get the invoke to work. (No worries)

    Using the UserData locations,... I simply run the PWM file in thread 3, if I push a button to change my spindle speed. In thread 2 if called by the S command in GCode. Both work independant of each other... and produce no conflict. Both update and work as they should.

    Thanks so much!
    Robot & Machine Design - BLUECNC4, GreenCNC3, RedCNC2L, SilverCNC2; CNC Software!
    www.truemachinedesign.com - - - - - - - - - - - - - www.truemachineautomation.com

Similar Threads

  1. Disable Feed and Speed override potentiometers - Heidenhain
    By doubravacek in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 1
    Last Post: 10-27-2011, 10:21 PM
  2. Spindle Override
    By cncweblangthang in forum Fanuc
    Replies: 1
    Last Post: 12-21-2009, 07:31 PM
  3. Feed Rate Override w/Spindle Overload
    By mecheng10 in forum Mach Mill
    Replies: 0
    Last Post: 08-13-2009, 03:42 AM
  4. Default feed override and manual jog speed settings?
    By InspirationTool in forum CNC (Mill / Lathe) Control Software (NC)
    Replies: 0
    Last Post: 02-22-2007, 11:04 PM
  5. spindle override
    By imca38x in forum Fadal
    Replies: 1
    Last Post: 09-09-2005, 05:25 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
  •