Setting up Feed, Rapid and Spindle override with potentiometers... - Page 2


Page 2 of 2 FirstFirst 12
Results 21 to 37 of 37

Thread: Setting up Feed, Rapid and Spindle override with potentiometers...

  1. #21
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    I'm not sure why that would be. Were they working before the change?

    Can you provide all the details so we can try to duplicate. Your Screen Script? How M3,M4,M5 are configured? Any Spindle Programs?

    Regards
    TK http://dynomotion.com


  2. #22
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Tom,
    Just checked with a INIT program before i added pots and the physical Spindle buttons do not work when a Gcode is running or in FeedHold, but when Gcode is not running the physical buttons work fine.Again, the keyboard hotkey buttons for spindle F9,F10,F11 do work when Gcode is running. So problem was before adding pots. Attached is my 3 screens and my c programs for M3,M4,M5 and the rigid tapping c code.
    Testing Gcode is simple....
    G20
    M3S500
    G01 X-.5 F10.
    G01Z-10.F10
    G01Z0F10
    G01X0.
    M30

    Let me know if there is something else you might need that i did not include.
    Thanks,
    Troy

    Attached Files Attached Files
    www.tsjobshop.com, www.homecncstuff.elementfx.com


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

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    I guess kmotioncnc is not allowing the M codes to be sent while a job is running. Instead of your init file sending an M code after pushing physical buttons, consider copying the M3/4/5 code directly into the init file. Should work that way.

    Glad you got the pots working the way you want. Isnt it awesome how we can get just about anything to work exactly how we want with just a few lines of code?

    Mark



  4. #24
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    Mark is correct. For safety reasons KMotionCNC rejects requests of MCodes or User Buttons while a Job is running. Maybe we should have an option to override this. Copying the code that eventually needs to execute should work and actually be faster and more reliable as it wouldn't depend on the PC. Shame to have duplicated code though. You could put the functions in an include file.

    We are working on new Screen Script functionality that might also solve this. Where Screen Script can push a screen button or a keyboard button. Also the ability for KFLOP to command KMotionCNC to execute Screen Script (without pushing a User Button to do so).

    Regards
    TK http://dynomotion.com


  5. #25
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Quote Originally Posted by mmurray70 View Post
    Hi Troy,

    I guess kmotioncnc is not allowing the M codes to be sent while a job is running. Instead of your init file sending an M code after pushing physical buttons, consider copying the M3/4/5 code directly into the init file. Should work that way.

    Glad you got the pots working the way you want. Isnt it awesome how we can get just about anything to work exactly how we want with just a few lines of code?

    Mark
    Hi Mark,Tom
    Iam always amazed at what is being done with C code. Wish i could comprehend it more tho.

    Hi Troy,

    Mark is correct. For safety reasons KMotionCNC rejects requests of MCodes or User Buttons while a Job is running. Maybe we should have an option to override this. Copying the code that eventually needs to execute should work and actually be faster and more reliable as it wouldn't depend on the PC. Shame to have duplicated code though. You could put the functions in an include file.

    We are working on new Screen Script functionality that might also solve this. Where Screen Script can push a screen button or a keyboard button. Also the ability for KFLOP to command KMotionCNC to execute Screen Script (without pushing a User Button to do so).
    Will see if iam successful at adding button code to INIT and will let you know.

    Thanks again guys,
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  6. #26
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Tried adding code but main INIT does run past the point where i added code and when i run main INIT code, spindle trys to start and then turns off. If i let machine set for a minute or so, spindle will try to start again! So needless to say i reverted back to an older program. What would be safer and more reliable, having spindle buttons connected to Konnect board like i have them or using the keyboard hotkeys? As the hotkeys seem to work no matter what.

    Thanks,
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


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

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    I would think you can still get it working reliably with external buttons, probably just some little bug somewhere in the code. Should be able to fix it. But honestly I find the hotkeys to work fine. Thats all im using. I had a start/stop button first but decided not to use them for some reason. At least doing it with the hot keys your code is only in one place, so if you make changes you dont have to remember to do it twice. And it will probably be easier to use delays for the spindle to ramp up this way too. Delays in the forever loop would obviously be a bad idea. I just mounted a keyboard directly to my controller and put some labels on the buttons for the spindle. See attached pic. Works fine for me.

    Mark

    Attached Thumbnails Attached Thumbnails Setting up Feed, Rapid and Spindle override with potentiometers...-fadal-decals-4-jpg   Setting up Feed, Rapid and Spindle override with potentiometers...-untitled-jpg  


  8. #28
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    You might have placed the code in the wrong place. Post the code and we can check it.

    Regards
    TK http://dynomotion.com


  9. #29
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Thats similar to what i have now on my mill.Except its not nicely layed out as yours. I plan to make a control panel for it after this lathe project is done. Using what i have learned from lathe buttons setup.

    www.tsjobshop.com, www.homecncstuff.elementfx.com


  10. #30
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Tom,
    Atttached is INIT c code. The Spindle CW and CCW also has the pop up reminder asking if 3 phase converter is on.
    Troy

    Attached Files Attached Files
    www.tsjobshop.com, www.homecncstuff.elementfx.com


  11. #31
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    You forgot to put in curly brackets.

    When you have a conditional statement like:

    if (result == 1)

    That means either the following single statement will only be executed when the condition is true, or the following block of code marked with curly brackets will only be executed when the condition is true.

    When you have:

    Code:
    if (result == 1)
    A;
    B;
    C;
    Only the A will be skipped if the condition is not true. B and C will always be executed regardless. Which is the problem you are seeing.

    If that is actually what you want you should indent the code to show only A is impacted by the if statement this like:

    Code:
    if (result == 1)
        A;
    B;
    C;
    But if you want to skip a bunch of instructions when the condition isn't true put them in curly brackets like this and indent the instructions to show they are all in the same block like this:

    Code:
    if (result == 1)
    {
        A;
        B;
        C;
    }
    Think of the curly brackets like shorthand for Begin and End statements.

    Note that indenting the instructions properly doesn't change how it will execute but just makes it easier to read and see problems.

    Let me know if this makes sense. If not we can correct it for you.

    Regards
    TK http://dynomotion.com


  12. #32
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Tom,
    I think i made some progress with the curly brackets The main INIT program appears to be running completely now and not stopping at the section that handles the Spindle buttons. But now i have a new issue. When i turn on spindle with my physical buttons the spindle starts and then about 1 second later it shuts off. This happens in both directions. Attached is updated INIT program.

    Thanks,
    Troy

    Attached Files Attached Files
    www.tsjobshop.com, www.homecncstuff.elementfx.com


  13. #33
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Quote Originally Posted by Need TECH Help! View Post
    Hi Tom,
    I think i made some progress with the curly brackets The main INIT program appears to be running completely now and not stopping at the section that handles the Spindle buttons. But now i have a new issue. When i turn on spindle with my physical buttons the spindle starts and then about 1 second later it shuts off. This happens in both directions. Attached is updated INIT program.

    Thanks,
    Troy
    Hi Troy,

    Looks like your making progress but still may have some issues with curly brackets. You have an If statement to check for spindle start button, and inside of that you have an if/else statement to check if phase converter is on. And I think its being read as, if button is pushed start spindle, else stop spindle. So any time button is not pushed the spindle will be told to stop. Its much easier to see whats going on if you indent the code something like this screenshot, see how it looks to be turning off spindle any time button is not pushed?

    Attached Thumbnails Attached Thumbnails Setting up Feed, Rapid and Spindle override with potentiometers...-code-jpg  
    Last edited by mmurray70; 12-07-2018 at 06:57 PM.


  14. #34
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    537
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Troy, see if this works. Im not 100% sure if its right or not. It is a little confusing with a few things going on there. Good luck with it.

    Mark

    Attached Files Attached Files


  15. #35
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    I think Mark is correct and fixed the CW button but the problem was with the CCW. Attached I tried to correct both. And formatted the entire file to make it more readable.

    Attached Files Attached Files
    Regards
    TK http://dynomotion.com


  16. #36
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    4045
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Hi Troy,

    This is a new feature that we will be releasing soon which may help with coding



    Regards
    TK http://dynomotion.com


  17. #37
    Member Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    578
    Downloads
    0
    Uploads
    0

    Default Re: Setting up Feed, Rapid and Spindle override with potentiometers...

    Code works moocho better now Thanks guys.
    Also checked out video earlier today, looks good and simple for me. Glad I could be a sort of test subject
    Will be waiting for the test release version.

    Thanks again,
    Troy

    www.tsjobshop.com, www.homecncstuff.elementfx.com


Page 2 of 2 FirstFirst 12

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

Setting up Feed, Rapid and Spindle override with potentiometers...

Setting up Feed, Rapid and Spindle override with potentiometers...