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


Page 3 of 4 FirstFirst 1234 LastLast
Results 25 to 36 of 37

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

  1. #25
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    440
    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

    http://www.homecncstuff.elementfx.com/


  2. #26
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    440
    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

    http://www.homecncstuff.elementfx.com/


  3. #27
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    351
    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  


  4. #28
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2986
    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.



  5. #29
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    440
    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.

    http://www.homecncstuff.elementfx.com/


  6. #30
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    440
    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
    http://www.homecncstuff.elementfx.com/


  7. #31
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2986
    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.



  8. #32
    Registered Need TECH Help!'s Avatar
    Join Date
    Dec 2007
    Location
    United States
    Posts
    440
    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
    http://www.homecncstuff.elementfx.com/


  9. #33
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    351
    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 07:57 PM.


  10. #34
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    351
    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


  11. #35
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2986
    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


  12. #36
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2986
    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





Page 3 of 4 FirstFirst 1234 LastLast

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...